News for hackers. Stuff that matters.
Re:Lessons of JSON by LeafStorm on Monday April 30, 2012 @02:02PM (#3910440)
In that case, you can use the appropriate XML format for the structured document content, then store than in a JSON string. Most of the time the "structured document content" you're sending over AJAX is HTML or SVG, and the browser can still handle parsing and validating it.
Re:Lessons of JSON by olavk on Monday April 30, 2012 @03:12PM (#3910881)
Yeah, and it works fine. But it is hard to argue that JSON+XML is a simpler data interchange format than just XML.

It might be better though, because the JSON and the XML is handled by different layers in the application anyway.

Re:Lessons of JSON by jacobolus on Monday April 30, 2012 @03:21PM (#3910914)
Sure it’s simpler: they’re used in two separate layers – each with its own purpose – which are consumed by separate components (and actually more, because when you send this down you’re of course wrapping it in HTTP and TCP &c.). For a better understanding of why this kind of design is simpler, and therefore better, I recommend Rich Hickey’s talk: http://www.infoq.com/presentations/Simple-Made-Easy

Edit inre “more complex compound data exchange format”: No, the point is that this should be thought of as two simple protocols wrapped one inside the other, not one “complex” format. Watch Rich Hickey’s talk. It would be a complex format if the two layers reached across into each-other, if the consumption of one depended on the details of the other, etc. But if they’re kept properly separate, that’s not complex – by Hickey’s definition anyhow, and I think it’s an excellent definition.

Re:Lessons of JSON by olavk on Monday April 30, 2012 @03:43PM (#3911023)
Agreed, the overall architecture may become simpler by choosing a more complex compound data exchange format.