4 ms·
Comments, trailing commas, and multiline strings. Comments, trailing commas, multiline strings, and a real date type. Comments, trailing commas, multiline str
by jerf 3y ago
Comments, trailing commas, and multiline strings.
Comments, trailing commas, multiline strings, and a real date type.
Comments, trailing commas, multiline strings, a real date type, and dropping the quotes on keys.
Comments, trailing commas, ...
JSON really isn't just the "simple tweak" away from being the perfect config language it is often presented as. There's this fun sort of error that only a group of people can make, where someone can stand up and make a statement like "JSON just needs a couple of tweaks to be the perfect config format!" and everyone can individually nod in agreement, and the group thinks it is in agreement. But it turns out every individual actually had a completely different interpretation of the statement and they don't agree at all. When you get a group of developers together to be clear about the changes to JSON you will discover not everybody has the same tweaks in mind.
(& I wrote this before seeing the sibling comment from enriquto who gives another thing necessary for perfection. I don't even 100% know what enriquto means by "standard" floating point numbers versus what is already in the spec, but I bet it's another thing that multiple people could nod in agreement to but in fact mean something quite different about if you nail them down to the spec level!)
- BurningFrog 3y ago"Perfect config language" is too high a standard. JSON could be much better, and good enough for far more purposes, with the top 3 tweaks there.
- lolinder 3y agoTo be fair to JSON, this is why there are no config formats that are good enough for everyone. They either try to meet all of these requirements and people complain they're too complex, or they choose a subset of the requirements and only satisfy a subset of people.
- jerf 3y agoStrong agree. I think it's not entirely unlike programming languages. If I sit down and write out all the features I want from a programming language, I can't have it. They straight-up contradict each other. As a simple example, I want simplicity and a rich type system. Nope. Not gonna happen. Intrinsically at odds with each other. And there are many other such places, more subtle than that but no less real. Config has the same thing going on. I've made my peace with just doing whatever's convenient in the moment and not stressing about it. It certainly isn't worth bringing in a new syntax my local team has never heard about because it's just the perfect little config syntax. It's very hard for any config syntax to be better enough than what came before to justify adding another tech to the stack.
- eviks 3y agoIt's not fair to JSON, and to see why you just need to add some quantities to the quality of "nothing is great for everyone". Like, a huge % of users would need comments, so that's a huge downside of JSON, and it doesn't matter that there is no perfect non-complex config format with floats (or whatever) since that would be too complicated
- scythe 3y agoI don't really think that any of those are as important as comments, though. Comments are indispensable for a self-documenting config file. Trailing commas and so forth are merely convenient. JSON with comments wouldn't be perfect, but it would be unacceptable a lot less often.
- m000 3y agoSupport for trailing commas is just the sane thing to do, especially since JSON is inspired by Javascript that already supports them. So does Python, Java, C++ and perhaps another half dozen of popular programming languages. Why the hell go the opposite way? I'm not sure who made the decision at the time, but looking back at the hours we have collectively wasted because of this non-feature, I believe they would have reconsidered.
- thayne 3y ago> Comments, trailing commas, and multiline strings. IMO, that would make it "good enough" for most use cases. Having the application parse a date from a string isn't too bad. And dropping quotes on keys is just a nicety. And really, trailing commas aren't strictly necessary either. But comments are absolutely necessary for a human readable configuration format. And multi-line strings are critical for any use case where you have strings that could be long. Like, say, a "description" field. As a sidenote, the absence of multi-line strings is a major frustration I have with writing JSON schemas in JSON.
- ok123456 3y agoI'd also like it if people would stop trying to enhance their own json parser/writer to support these adhoc, and still calling it json. It's nice to have NaN/Inf support until someone eventually tries to use it with another library which doesn't.