Jsonnet is not so bad

Okay, jsonnet does not have such a bad experience nowadays – there is a pretty good LSP server implementation thanks to the team at Grafana, there’s jsonnetfmt that makes the jsonnet code style the same across projects, and we have LLMs that make it much easier to learn any new language.

Also, since it is an interpreted language that simply yields JSON, it is very easy to prototype and test changes. This was especially apparent during the recent hackathon where our team used jsonnet to implement a “dynamic dashboard generator” in Grafana, and we won the prize. Since all Grafana dashboards are JSONs, it is very to generate them with a language specifically geared towards it.

The problem with JSON, though, is that it by itself has no schema. That is implemented by the JSON schema project. And even then, it is not ideal because it doesn’t fully express all constraints that you might need, e.g. if some value is X, then another value can only be between 0 and 42. Plus, jsonnet has no relation to json schema except that both use jsons. Grafana also famously doesn’t have any (strict) JSON schema. There has been some movement towards it but still no formal specification exists as far as I know.