JSON is great, but it is not nearly as flexible as XML, partly because of attributes. Also, because of it's JS heritage and compatibility, lots of common things are not representable in JSON. This is mostly because object keys MUST be strings. Examples: In [1]: from simplejson import dumps In [2]: dumps({1: 5, '1': 0}) Out[2]: '{"1": 0, "1": 5}' Derp, good luck figuring out what that is supposed to mean. In [3]: dump…
You're feigning outrage. It's a valid and well-documented design decision that keys in JSON are strings. If you want a language-specific serialization format based on JSON, come up with a dialect.
JSON or XML: Just Decide
11–20 of 44 posts
Re: JSON or XML: Just Decide
#12Re: JSON or XML: Just Decide
#13JSON is great, but it is not nearly as flexible as XML, partly because of attributes. Also, because of it's JS heritage and compatibility, lots of common things are not representable in JSON. This is mostly because object keys MUST be strings. Examples: In [1]: from simplejson import dumps In [2]: dumps({1: 5, '1': 0}) Out[2]: '{"1": 0, "1": 5}' Derp, good luck figuring out what that is supposed to mean. In [3]: dump…
I have spent equal amounts of time with XML and JSON. Here is what my experience told me: 1] XML is painful to write. 2] Languages don't natively support it. It always requires additional drivers/libraries. 3] Its non-trivial to store XML also. With the solutions that were out there we would always run into some requirements which the database didn't support, and had to done in the business logic. JSON databases (I u…
Re: JSON or XML: Just Decide
#14http://en.wikipedia.org/wiki/Markup_language
It was designed for documents. Try converting an HTML page to JSON. Try something as simple as:
Hello World!
The most common introductory program is called
Hello, World .
Go on. If you think JSON wins, just do it, and post it below.The problem was when people started mis-applying XML to send data structures, for RPC, and similar tasks. That's not what it was designed for. JSON is a cross-language way of specifying common data structures, and is very good at doing that.
Re: JSON or XML: Just Decide
#15Re: JSON or XML: Just Decide
#16I like Turtle: dc:title "RDF/XML Syntax Specification (Revised)" ; ex:editor [ ex:fullname "Dave Beckett"; ex:homePage ] . It's only useful if you drank the RDF kool-aid (like I have), though.
Re: JSON or XML: Just Decide
#17JSON is great, but it is not nearly as flexible as XML, partly because of attributes. Also, because of it's JS heritage and compatibility, lots of common things are not representable in JSON. This is mostly because object keys MUST be strings. Examples: In [1]: from simplejson import dumps In [2]: dumps({1: 5, '1': 0}) Out[2]: '{"1": 0, "1": 5}' Derp, good luck figuring out what that is supposed to mean. In [3]: dump…
Re: JSON or XML: Just Decide
#18Or... they're designed for different purposes and not even competitors. XML is a markup language: http://en.wikipedia.org/wiki/Markup_language It was designed for documents. Try converting an HTML page to JSON. Try something as simple as: Hello World! The most common introductory program is called Hello, World . Go on. If you think JSON wins, just do it, and post it below. The problem was when people started mis-appl…
Re: JSON or XML: Just Decide
#19YAML :)