Hacker News new | ask | show | jobs
by laumars 2286 days ago
For what it's worth, I agree with you. JSON is meant to be machine readable rather than human writeable and while I don't mind reading through JSON files, I really don't enjoy editing them because it's easy to break (eg including a trailing comma on the last entry in a map or array).

The lack of comments in JSON is an often raised point and it's really useful being able to add comments in a "living" config file.

The other issue I have with many JSON config files is they don't always contain all the options, so you end up having to search around for what the right directive is to add to a particular config file (this is my biggest gripe with hacking VS Code config files). This is less of an issue with other formats because you can often comment out lesser used directives.

I think the reason JSON is popular for config files is because it's easy to implement rather than easy to maintain and I see JSON as a regression from the TOML / INI etc formats that used to be commonplace beforehand.

I also agree with your frustrations with the replies about "people who know how to use a terminal know how to use JSON"; sure they do but that doesn't mean it is appropriate usage of JSON. I could write a config file using golfed Bash and say "but you should know how to read and write Bash" but people would understandably dismiss that saying it's still not user friendly and I don't see your point here any different.

1 comments

Note that the JSON config files for Windows Terminal and VSCode do accept double-slash comments.

Annoyingly, they don't allow trailing commas, but I suppose it's easier to strip out comments before parsing than it is to customise the JSON parser.