Wow! Thank you so much for showing me this.

I never before wanted to write object oriented JSON, but now my mind has been opened.

For those who haven't yet seen it/opened the link, it's 20% project that describes itself as:

> A data templating language for app and tool developers

- Generate config data

- Side-effect free

- Organize, simplify, unify

- Manage sprawling config

> A simple extension of JSON

- Open source (Apache 2.0)

- Familiar syntax

- Reformatter, linter, editor & IDE integrations

- Formally specified

Yeah. It’s a pretty sweet tool. What’s also pretty awesome about it is that its interpreters (one C++ and one Go implementation) can also easily be embedded into custom applications.

For an Open Source project of mine (https://github.com/buildbarn, a remote build cluster implementation for the Bazel build system), we are using go-jsonnet as the config file parser library. This means that people can use JSON, but if they need something that’s more flexible, they can add Jsonnet statements immediately. It’s also possible to have that as a preprocessing stage (init scripts), but in a containerized world it’s easier to have it embedded.

One of the nice things about doing that is that I also don’t need to write code to load TLS certificate data from disk. People can either embed their secrets directly into the config file, or they can use Jsonnet’s ‘importstr’ keyword to load separate PEM files from disk.

Somewhat related to that: Jsonnet also allows people to write libraries for constructing more complex JSON files. For example, the Grafana folks have released a library (https://github.com/grafana/grafonnet-lib) that allows you to easily build Grafana dashboards from code.