3 ms·
JSON is a great configuration language: * It's in the standard library for most languages so you can write tools that read and write it that have zero dependen
by ukoki 4y ago
JSON is a great configuration language:
* It's in the standard library for most languages so you can write tools that read and write it that have zero dependencies. This is great for portability and for use in offline environments.
* You can use the same JSON files as input for tools that expect JSON (eg Terraform .tfvars.json) and tools that that expect YAML (anything kubernetes related)
* You can easily see at a glance exactly what whitespace characters are in multiline strings like PEM certificate strings. This is useful to avoid LF vs CRLF line ending issues, and ensuring start and end whitespace is exactly what you want to make sure input strings are compatible with whatever is consuming the configuration.
The downside is that it's a little bit ugly compared to YAML, but editor auto-formatting and key-sorting plugins make that a minor issue.
- luismedel 4y agoIMHO points 1 and 2 are more community efforts rather than JSON's design strengths. Regarding point 3, are you talking about using \n in single-line strings (the ones you can use in JSON) I think that the main reason this debate exists is we are using a good data-format (which JSON is) to configure things, which it's not a use case JSON is designed for.