10 ms·
JSON is fine for inter-machine communication (like APIs). It's IMO terrible for human-to-machine communication (like configs), which is why there are so many al
by noctune 3y ago
JSON is fine for inter-machine communication (like APIs). It's IMO terrible for human-to-machine communication (like configs), which is why there are so many alternatives trying to improve in this space (TOML, YAML, RON, etc.).
- lucasyvas 3y agoI would say I've mostly landed on JSON by default and TOML for configs when possible. Otherwise, that ends up being JSON too.
- GrumpySloth 3y agoFor inter-machine communication TLV binary formats are far superior. Simplicity of parsing, efficiency. Can't compete.
- Ennea 3y agoJSON still wins because everything already has a JSON parser.
- the8472 3y agoOnly when various performance metrics are not important enough to consider alternatives.
- twic 3y agoIf performance matters, TLV doesn't cut it either, you need fixed-offset fields. Self-describing binary formats like CBOR, BSON, bencode, DER, UBJSON, etc fall between two stools, being less hackable than JSON and slower than schema-driven binary formats, which is why they are all moribund today.
- Ygg2 3y agoEverything has JSON because everything has a web browser with JS these days. Calculation can change if browsers stop shipping or stop shipping with JS.
- pharmakom 3y agoDhall is the most interesting alternative because it can be compiled to JSON easily
- capableweb 3y agoThat's like the least interesting feature from Dhall, and also probably one of the most common features of any new format. Not sure I could mention any even semi-popular format that cannot easily be converted to JSON.
- cies 3y agohttps://dhall-lang.org/ https://dhall-lang.org/ Cool indeed. I wonder how you can supply it with types from the program that consumes the config. My Gradle config is in Kotlin these days. Kotlin, besides being a full blown prog lang, has nice features for config specs (map/list literals, typed, eDSL syntax). Though it is an enormous dependency (way to big for a project that just needs a config file format).
- piaste 3y agoThe bigger Dhall type libraries are usually generated from OpenAPI specs - there is a core package that consumes them. If your language has an OpenAPI library, you can create a hello-world web app that exposes your configuration object as an HTTP endpoint, and generate Dhall types from that.
- BiteCode_dev 3y agoAfter trying both Dhall and Cuelang, I really prefer the latter. But this turns out to support OP's point. JSON is good enough, and there are many alternatives that we are debating and don't agree on. So if you have to pick something, and I have to pick something, since we don't agree, we will fallback on JSON.
- Brian_K_White 3y agoman, nailed that
- Ygg2 3y agoJSON is perfectly human readable. Anyone claiming otherwise hasn't seen a binary format. Where JSON mainly fails as config format is lack of comments. Comment provide help and structure when editing. While allowing to toggle functionality. Which is where trailing commas help.
- HopenHeyHi 3y agoLets spend months replacing a thing that actually currently works with a slightly nicer to read file format with new and exciting bugs? Use a prettifier plugin in your editor or squint, silly human. Trailing-comma-on-write-annoyance-adjuster, bada-bing, bada-boom. Most of the peeves can be hidden with good tooling. This Ron thing makes sense because of Serde not because it is prettier.
- cassepipe 3y agoLet's not forget KDL! : https://kdl.dev/ https://kdl.dev/
- vvillena 3y agoHOCON is a great human-readable alternative to JSON. It's a superset of JSON with lots of cool features that make it both more readable and easier to use. Here's a rundown of HOCON's main features: https://github.com/lightbend/config#features-of-hocon https://github.com/lightbend/config#features-of-hocon
- camdenreslink 3y agoI have had great experience with HOCON. I miss it in non-JVM languages.