Examining JSON
I find it amusing that in all of the recent JSON[-RPC] vs XML[-RPC] discussion, I see a lot of opinions, but I don’t see a single instance where the actual wire level bits were examined, let alone be analyzed.
Here’s an example from the now deprecated Google SOAP interface. The equivalent in JSON-RPC would be:
{ "method": "googleGateway.search", "params": [ "absurd obfuscation", 0, 10, 1, "", "", 0, "latin1", "latin1", "00000000000000000000000000000000" ] }
Alternately, if one wishes to preserve the named parameter association of the original SOAP interface, you would end up with something like this:
{ "method": "doGoogleSearch", "params": [ { "key": "00000000000000000000000000000000", "q": "absurd obfuscation", "start": 0, "maxResults": 10, "filter": "true", "restrict": "", "safeSearch": "false", "lr" : "", "ie": "latin1", "oe": "latin1" } ] }
I’ve seen enough character encoding errors in allegedly XML content to say that unlike Tim, I don’t see that as a slam-dunk reason to prefer XML in order to improve your chances for interop on the web.
The advantage I see to JSON is when you don’t really have a need to be redundantly self-descriptive, an example being Planet Intertwingly’s memes.json.