Jsonnet is a data templating language that generates JSON from a more expressive functional syntax.
Jsonnet solves the problem of writing repetitive or complex JSON configuration by providing a language with variables, functions, conditionals, and other programming constructs that compile down to plain JSON. The approach treats configuration as code, allowing developers to reduce duplication and express logic that would be tedious or impossible to represent directly in JSON. The tool includes a standard library and supports imports, making it suitable for managing large configuration files across multiple environments.
Jsonnet works well for teams managing infrastructure-as-code, Kubernetes manifests, or other JSON-based configurations where templating reduces maintenance burden. It suits projects where configuration needs to vary across environments or where shared patterns appear repeatedly. The README recommends the Go implementation as a newer alternative that offers significantly better performance in many cases, though this repository contains the original C++ implementation. The tool is not recommended for processing untrusted Jsonnet code, as the C++ version is not hardened against malicious input, and language constructs like import and importstr can access any file readable by the interpreter process unless explicitly restricted.
The project maintains a comprehensive test suite and supports multiple build systems including Makefile, Bazel, and CMake. The repository includes tooling for code formatting through jsonnetfmt and provides local development infrastructure for testing and documentation generation. The project hosts discussion forums for community engagement and maintains detailed documentation on its website alongside the implementation.