Closed getify closed 11 years ago
{ 'because': { '80': 'percent' }, {'of': 'JSON', 'is': 'brackets' } }
@mojombo your JSON
is invalid (keys must be in double quotes). Perhaps you should brush up on the worlds most popular object notation before attempting to come up with an alternative.
@getify also, JSON doesn't allow comments, which can be useful
@danielribeiro It's all great fun until someone misses an indent. Then someone dies. :trollface:
@jm I kinda like the idea of disrupting YAML, JSON and INI files, all at once. The fact that nobody even had mentioned XML is a huge win already.
@danielribeiro re: xml - it's only been an hour, the night is young. :beers:
I like brackets. Brackets are cool.
but what about XML?
@danielribeiro check this out. https://github.com/bevry/cson
@meeech It's true that JSON doesn't have comments, but there are some ways around it, like piping the JSON configuration file through a minifier before directly using it. It's actually suggested to do this by Crockford himself.
@meech @clarle i happen to have written a simple PoC for pre-processing JSON to strip comments (and, in this case, whitespace too, since that's basically free): JSON.minify.
I've been advocating the usage of comments in JSON (when used as config files, not when used as a transmission data format) for a few years now. So the lack of comments is a non-issue as far as I'm concerned.
The "verbosity" of having too many { } is a different issue. I guess that's more a matter of taste, because I find it helpful to disambiguate nesting more than whitespace or just free-range section headers.
@jm I love you comments, it's so lovely!
JSON is not necessarily human-readable. It doesn't allow comments, for frivolous reasons:
“people were using comments wrongly, so I removed them. Also, handling comments made the parser harder to implement, so I removed them. Also, comments didn’t exist in YAML and I wanted JSON to look like YAML, so I removed them.”
It also requires double quotes, for no apparent reason. Deep nesting sucks.
@jm just like missing a bracket, but way easier to spot :)
CSON was a great idea, but the implementation is a hack.
"and" : { "json" : { "is" : "prone" , "to" : [ "syntax", "errors" ] } } }
Such as the one in here
hogwash. because xml and yaml and toml and every other format ever conceived are immune to syntax errors and json is a magnet for them. riiiight.
@getify Are you really trying to imply that all languages are equally susceptible to syntax errors? Talk about hogwash...
@BurntSushi I am not implying anything. I'm coming right out and saying bluntly and directly that JSON's susceptibility to syntax errors is no more of a disqualification for it as a format for config files (and such) than a variety of other formats that are used for that same task. That doesn't say they're equal, it's says the differences are not enough to matter in this discussion.
To suggest, in a strawman way as @88Alex did, that it's somehow more "prone" to errors than others, without any concrete comparison or support except a stupid joke of an example, is... well... hogwash.
I write lots of JSON in config files and I use a good editor that helps me find errors before I even save the file, and I don't make many mistakes writing JSON anyway, so it's not an issue for me. If you have trouble writing JSON, I bet you have trouble writing lots of other curly-brace things like, you know, every C-descendant language on the planet.
If you have trouble writing JSON, I feel bad for you son, I got 99 problems but JSON syntax aint one.
I am not implying anything. I'm coming right out and saying bluntly and directly that JSON's susceptibility to syntax errors is no more of a disqualification for it as a format for config files (and such) than a variety of other formats that are used for that same task.
If you were blunt, then you'd say: "I don't acknowledge the susceptibility of syntax errors as a valid reason to choose a configuration file format."
That's cool. But clearly other people here do. Feel bad for us all you want.
I write lots of JSON in config files and I use a good editor that helps me find errors before I even save the file, and I don't make many mistakes writing JSON anyway, so it's not an issue for me. If you have trouble writing JSON, I bet you have trouble writing lots of other curly-brace things like, you know, every C-descendant language on the planet.
Allow me to bow down to your superior skill at writing JSON.
If you were blunt, then you'd say: "I don't acknowledge the susceptibility of syntax errors as a valid reason to choose a configuration file format."
That's not what I'm saying. I guess I have to say it a third time. I am saying that even if JSON is a bit more prone to syntax errors, because it has more syntax than say, TOML, that extra susceptibility is not enough to abjectly disqualify JSON as a config file format.
You can prefer a simpler format (like TOML), fine. But this issue thread isn't about opinions of why TOML is better than JSON at configuration. That's a subjective discussion at best. It's about my objection to the statement that JSON is so much self-obviously inferior at this task as to not even warrant an explanation of the inferiority, with the smug "You know why." I genuinely wanted to know if there was actually anything objective or concrete underlying the subjective sarcasm.
To suggest/imply that JSON is so much more prone to errors than any other candidate format as to justify, just as this thread's original quote ("No, JSON doesn't count.") does, dismissiveness, and really not have anything except sarcasm to back that up... that's why I object(ed).
The confirmation from how this thread has largely gone thus far is that there really isn't any actual justification, just personal bias. And that's fine.
Allow me to bow down to your superior skill at writing JSON.
Thanks for putting me in my place. You clearly have the superior skills at everything else, especially sarcasm.
The differences were enough to warrant the creation of a totally new format. Judging by the project's uptake, it resonated with a lot of people.
Not long ago JSON overtook XML, but XML is a "fine" format too.
The confirmation from how this thread has largely gone thus far is that there really isn't any actual justification, just personal bias.
@getify I gave at least two objective reasons (readability, comments). Before you say readability is subjective, JSON can be minified, TOML can't, and there is a pretty concrete basis (number of control characters) to say that.
I genuinely wanted to know if there was actually anything objective or concrete underlying the subjective sarcasm.
The continued annoyances that people (not you) have with writing JSON. I can't imagine what other evidence there could be.
Thanks for putting me in my place.
My pleasure.
@BurntSushi @getify
Pretty new to GitHub. You both made me laugh while I was reading this at work. Thanks.
Actually, no, I don't know why. Why? (not trolling, serious)