3 ms·
Seems I'm in the minority here, but I agree with the author on his main point. JSON is fantastic for organizing and passing data around, storing it, even for c
by betwixthewires 4y ago
Seems I'm in the minority here, but I agree with the author on his main point.
JSON is fantastic for organizing and passing data around, storing it, even for configuration files where the user doesn't need to edit the raw configuration. If you are like me and write a lot of tools that run in the background, lack a UI and where the only thing a user will be doing is editing a configuration file and running it, you're asking for trouble with JSON. Curly brackets and nesting and lack of basic formatting are bad for UX, and while it's a fantastic compromise for machine and human readability, it focuses more on machine readability and the human readability is just enough for you to look at it. It is not easy for a human to parse with their eyes.
I go with TOML for my configuration files most of the time. I am not a fan of YAML or XML. I don't think those offer any real benefit over JSON, and both have more downsides than JSON. TOML is a breeze to read and understand just looking at it, and is analogous to JSON as far as machine readability to the point that it's trivial to convert to it when you need to.
I do use JSON a lot, even for configuration files, but only when I'm storing a configuration in a flat file that the user should never have to see.
- kcartlidge 4y agoI'd agree. JSON is user-readable, but not really user-friendly and user-editable. I'm okay with YAML but TBH, and I know this makes me totally uncool, for config that only nests to a single level I quite like INI files. I sometimes cheat slightly and take account of the ordering of entries in a section but generally speaking it's easy to read, easy to write, and very easy to parse.
- dan_hawkins 4y agoAlso: no comments in JSON. This makes self-documented config files difficult to create and maintain.