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

justin walters walters.justin01 at gmail.com
Wed Jun 14 22:46:14 EDT 2017


On Wed, Jun 14, 2017 at 7:33 PM, Michael Torrie <torriem at gmail.com> wrote:

> On 06/14/2017 05:06 PM, justin walters wrote:
> > JSON in Python is such a joy! :)
>
> 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, including the XML beast. XML may be verbose, but at least
> XML data can be formally validated and formally transformed and queried,
> which is certainly not the case with JSON as we can see from this long
> thread.  JSON's mantra seems to be try parsing it and see what happens.
> Whether it works depends on the parser and any quirks it has (quotes vs
> single quotes, etc).  I don't find JSON any more human readable than XML
> to be honest, perhaps less so because there's no way to define a formal
> schema to follow, at least that I'm aware of.
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>

There are 2 main issues with XML:

1) It is not secure. Check this out:
https://stackoverflow.com/questions/1906927/xml-vulnerabilities#1907500

2) It is large. JSON can express the same amount of information while
using much less memory. There are many reasons for this, but the simplest
is that JSON formatting requires less characters.

Also, there are several formal schemas to follow. The most popular is
JSONAPI.

JSON is also fundamentally much simpler than XML. There are strings,
numbers,
arrays, and objects. That's it. It is basically a dumbed down Python
dictionary.



More information about the Python-list mailing list