On 9/12/2011 6:11 PM, Ron Wilson wrote:
I am surprised that none of the major JSON parsers would not have any
means (either directly or by being called by an XML/HTML parser) to
process JSON embedded inside XML or HTML.

JSON can be embedded in HTML, but to do this reliably, you must do a lot more unicode and HTML character escaping than is necessary for serving plain JSON. Rails will output JSON formatted that way since some version (but not since always), and PHP added the capability to their encoder in 5.2 or 5.3. The only decoders I know that can natively handle such JSON embedded in HTML are, of course, web browsers. But the parsers for web browsers are monsters, and JSON is designed to be extremely simple to parse. And JSON inside HTML has no inherent meaning--the HTML context obscures the simple here's-an-object concept--so of course what's really happening is that JSON in HTML is plain old JavaScript. Without accompanying code (an assignment statement, at a minimum), it does nothing and means nothing.

--
Joshua Paine
LetterBlock: Web Applications Built With Joy
http://letterblock.com/
301-576-1920
_______________________________________________
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to