Re:Show HN: jql – Easier jq Alternative with a Lispy Syntax ...
by iudqnolq on Wednesday January 08, 2020 @03:51AM
(#21989644)
> This means that people can use JSON, but if they need something that’s more flexible, they can add Jsonnet statements immediately.
That sounds awesome. I'd expect it's worth it just to have self and $.
And not only that, jsonnet can also produce yaml and ini files. I might try using it to configure my whole machine...
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.