PS - IMHO, you are right in the comments that it is scary to work with the format without comments
PPS - I'm a Javascript developer, there is a Javascript tag on the post - so answer subjectively from this side
Why store configuration data in JSON?
It is very simple. In javascript. . Since JSON is formatted as Object in JS, you can have the same syntax for server objects, client-side objects, and data stores. When you want to debug something, you can just grab the whole JSON and paste it into your code like var obj = JSON and it works. You can find more at the http://www.json.org/ Crockford website.
Why is it important "a lot of noise in the form of braces, identification, double quotes ..."?
The first reason is, of course, the detection of a syntax error . If you have strong syntax instead of "pure key / pair values", you may find much faster and easily missing semicolons or curly braces. Also very important - parsing large files is faster .
The second reason is the different syntax for arrays, objects, strings, and Booleans. You want the line option "true", boolean true and number true - 1, because you want to work with many databases, repositories, APIs, programming languages โโ- you need to support the whole scale .
Identification and JSON relationships are not a problem. JSON can be single line. In configuration files, it is quite impractical (stackoverflow users can parse it, DDD, but there arenโt "normal people").
The third reason is the relationship between parents and children. Let there be a sample:
[ { "email": " samuel@dude.com ", "isAdmin" : true, "password": "KMLA#SLDOPW#", "modules" : [ "html", "js", "css" ], "creditcard" : { "number" : 3288942398329832, "expiration" : "2011-07-14T19:43:37+0100" } }, { "email": " bill@dude.com ", "isAdmin" : true, "password": "KMLA#SLDOPW#", "modules" : [ "js", "nodejs" ], "creditcard" : { "number" : 20432943092423, "expiration" : "2011-07-14T19:43:37+0100" } }, { "email": " thomas@dude.com ", "isAdmin" : false, "password": "KMLA#SLDOPW#", "modules" : [ "ruby", "python", "css" ], "creditcard" : { "number" : 4239093223423, "expiration" : "2011-07-14T19:43:37+0100" } } ]
.. Do you want to register all letters in the console?
jsonobj.forEach(function(ele){ console.log(ele.email); });
.. do you want to have access to the first user's credit card number?
jsonobj[0].creditcard.number
.. Do you want to add the next user? jsonobj.push({ email: " peter@dude.com :, isAdmin: false })
.. Do you want to parse a file without an external library? JSON.parse(jsonrawfile);
JSON vs. XML
A very nice way is to have XML. But about this google try some differences. I think front-end developers are XML fans like IE6 fans. There are more reasons why this is so. Try Google for this.
Hope this helps a lot.