logoalt Hacker News

arp24212/09/20244 repliesview on HN

The thing is that JSON was intended to be a data exchange format, not a configuration file format or anything else. IMHO Crockford's reasoning makes a lot more sense with that in mind.


Replies

hn_throwaway_9912/09/2024

JSON is a human-readable data exchange format. There is a good reason human-readable data exchange formats are so popular - they can be read and understood by humans! So it seems pretty absurd that a format designed to be read by humans doesn't support comments. If you're really concerned about performance or size, you should use a more efficient binary format for data exchange like protobufs, or heck, BSON (binary json)!

layer812/09/2024

XML was intended as a data exchange format and has comments. Image file formats like JPEG and PNG support comments (and so does SVG by virtue of being XML). Database systems support comments on database objects. It’s really not a convincing argument.

gregoriol12/09/2024

Even if we stick to the data exchange format, it would be practical to have comments in examples of data. This would be good for training and learning, for documentation.

show 2 replies
JambalayaJimbo12/09/2024

Data interchange formats are often used for configuration. It makes sense to have a single source of truth in json if your configuration is consumed by an app.