Re:The Architecture of Open Source Applications: Nginx
by librvf on Monday November 30, 2015 @01:53PM
(#10650982)
To be fair, while I agree that JSON is bad for config, I would argue that JSON's objects and arrays eliminate the need for DTDs and standard query languages altogether in many cases. Of course, with sufficiently lqrge and complex data stores, you'll want a documented structure and method for accessing that data no matter what format you use, but unlike XML, JSON provides structure to get started on a small scale very easily.
Consider this python:
This will accept JSON on standard input and will return the value of an object with the key name specified by the first command-line argument.
Such a program will look similar in any language with a json library that maps objects and arrays to native data structures. Granted, my simple tool will fail if the JSON isn't an object, but it's a very simple matter to extend it to handle lists and literals. For many applications this is a huge advantage over XML, especially if the point of the JSON isn't configuration but rather inter-application communication (aka data serialization).
[ Parent
| on HN ]
There are no comments on this comment yet.