5 ms·
You might like JSON5 (https://json5.org https://json5.org), which allows comments and has direct support in various tooling.
by crooked-v 6y ago
You might like JSON5 (https://json5.org https://json5.org), which allows comments and has direct support in various tooling.
- amelius 6y agoYes, thanks, but are the comments stripped out when you read the JSON? Or are they still accessible, so they can be written back when a program modifies the JSON slightly?
- kroltan 6y agoThat's a software problem moreso than a parsing problem. Plenty of software that uses regular JSON also strips unused data when writing back to a file it read because internally it transforms the document into a data structure with no space dedicated for unknown data. It would be up to the software, or a very strict standard or library, to preserve unknown/unused data.
- ehsankia 6y agoThere are many json alts, but at the end of the day unless it's supported everywhere, it kinda defeats the point, because what makes JSON great is that it's supported almost everywhere.
- hajile 6y agoOnce upon a time (a mere decade ago) JSON support was nowhere.
- dmurray 6y ago90% of when I use JSON is when I control both sides of the interaction. E.g. a web app where I have no expectation of third party clients, or a config file that will only reasonably be read by one program. JSON is normally "good enough" as a general wire interchange format, and it's human-readable and whoever comes after me will already be familiar with it. But if there's a time when it's not good enough and its failures are in expressiveness, I'd totally consider JSON5 or some other alternative instead.
- baddox 6y agoEven for end-to-end internal projects, as soon as you stop using a built-in format and need to use thirdPartyEncode and thirdPartyDecode on both ends, you might as well just choose the absolute best third party library rather than choose something that slightly enhances the built-in.