[OT] is JSON all that great? - was Re: API Help

Grant Edwards grant.b.edwards at gmail.com
Wed Jun 14 23:06:40 EDT 2017


On 2017-06-15, Michael Torrie <torriem at gmail.com> wrote:
> On 06/14/2017 05:06 PM, justin walters wrote:
>> JSON in Python is such a joy! :)

100% agreement here.

> I understand that in this case the data is coming from a server in a
> form intended for easy use with Javascript.  But other than this
> type of communication, I don't see any good reason to choose JSON as
> a data interchange format.
>
> To me JSON seems to hold no real benefits over other serialization
> techniques,

A JSON library is usually several orders of magnitude smaller, faster,
and easier to use than an XML library.  To some of us, that matters a
lot.

> including the XML beast. XML may be verbose, but at least XML data
> can be formally validated

To paraphrase Knuth: You can prove an XML file is correct -- but it
still won't work. ;)

Every time I've used anything involving XML, it was a complete and
utter nightmare with no two toolsets/libraries able to agree on
anything.  OTOH, I've been using JSON for years, and never run into
problems like that.  Verifying files from schemas never worked,
transforming files never worked.

I hate XML with a passion...

JSON does have it's warts: it should allow trailing commas in
sequences of object or array entries.  Most parsers don't try to do
any sort of error recovery: either the file parses, and you get all
the data, or it fails and you get nothing.

--
Grant






More information about the Python-list mailing list