3 ms·
How do you tell if a file is json or json5? Feels better to forget about json for config and go with the obvious TOML that has single file extension with single
by h1d 8y ago
How do you tell if a file is json or json5? Feels better to forget about json for config and go with the obvious TOML that has single file extension with single standard.
- DonHopkins 8y agoWhile J4X would simply let you specify the version number in the DTD, if course! ;) https://news.ycombinator.com/item?id=19656646 https://news.ycombinator.com/item?id=19656646
- int_19h 8y agoIf you're trying to parse it, you don't need to tell. Just parse as JSON5, it's a strict superset. And if you're editing a file, you can usually tell by the fact that there are comments in it. :)
- h1d 8y agoOfficial json5 site does mention using .json5 extension to be obvious but I bet people will just use .json which will be confusing if the file is passed to another party and they get parse error until they realize it's json5. I think the only downside to json5 is that they inherited the name json instead of coming up with a different name.