Live data from Hacker News

Why do so many tools have JSON config files?

textlog.cc

11–20 of 78 posts

Re: Why do so many tools have JSON config files?

#12

TOML is a better format for configuration files IMO, if not for many reasons, primarily because TOML accepts comments. However, one annoying thing for TOML was the lack of schema, and the reliance on JSON Schema for that. Which I decided to tackle years ago when I started the TOML Schema project. In the past few months I leveraged code agents to take to the finish line and got something compelling: tomlschema.org

Interesting. The website says that it's "validation-focused". I don't know how that plays out for TOML, but the lack of focus in json schema to define an interface in addition to validation can be very frustrating. Most of the time I would rather trade off some expressitivity in terms of validation in favor of having a defined typed interface into the validated data.

Re: Why do so many tools have JSON config files?

#13
post #5

JSON is obviously a poor choice. It's job is to interchange data, produced and parsed by computers. ESR had the idea of writing configuration in English. It didn't gain traction at the time, but we have LLMs now. It might be a good idea to revisit the idea of accepting plain english. The LLM output could then be any format that's easy and unambiguous to parse.

[dead]

Re: Why do so many tools have JSON config files?

#15
because JSON is in the following sense "universal":

every format/structure that has numbers, strings, booleans, null/none, finite lists of items, and string-indexed records of items already contains JSON

and that's pretty much the barebones you need for a configuration language

(of course you can argue about the syntax)

Re: Why do so many tools have JSON config files?

#16
post #15

because JSON is in the following sense "universal": every format/structure that has numbers, strings, booleans, null/none, finite lists of items, and string-indexed records of items already contains JSON and that's pretty much the barebones you need for a configuration language (of course you can argue about the syntax)

Lack of comments is pretty big though for a human editable config.

Re: Why do so many tools have JSON config files?

#17

TOML is a better format for configuration files IMO, if not for many reasons, primarily because TOML accepts comments. However, one annoying thing for TOML was the lack of schema, and the reliance on JSON Schema for that. Which I decided to tackle years ago when I started the TOML Schema project. In the past few months I leveraged code agents to take to the finish line and got something compelling: tomlschema.org

I find TOML is nowhere near as good as YAML. I'd even rather use jsonc.

Re: Why do so many tools have JSON config files?

#18
post #15

because JSON is in the following sense "universal": every format/structure that has numbers, strings, booleans, null/none, finite lists of items, and string-indexed records of items already contains JSON and that's pretty much the barebones you need for a configuration language (of course you can argue about the syntax)

It's so simple and straightforward, and that's why Douglas Crockford claims he "discovered" it, rather than invented it.

Re: Why do so many tools have JSON config files?

#19
post #16
post #15

because JSON is in the following sense "universal": every format/structure that has numbers, strings, booleans, null/none, finite lists of items, and string-indexed records of items already contains JSON and that's pretty much the barebones you need for a configuration language (of course you can argue about the syntax)

Lack of comments is pretty big though for a human editable config .

It’s just one person’s opinion, but I think two things are true enough, here…

1) JSON is pretty darn good for storing configuration. Everything speaks it, and a pretty printed one is very readable/tweakable in a pinch.

2) If you insist that someone manually edit a significant amount of it, you kinda fucked up.

Just my opinion, but it feels like two separate things.

Post reply on HN