Jsonnet is a structured configuration generation language that extends JSON with variables, conditionals, and object-oriented features to create reusable templates. It is designed to eliminate duplication in configuration data by providing a data templating language that can produce structured output from concise, programmable templates.
The language distinguishes itself through an object-oriented inheritance model that allows field override, mixin composition, and self-referencing for modular configuration reuse. It supports lazy evaluation with thunks to defer computation until values are first accessed, and includes trampoline-based tail call optimization to handle deeply recursive functions without stack overflow. Jsonnet also provides a C-based embedding API with garbage-controlled memory management, import graph resolution for modular templates, and manifest-based serialization that transforms internal representations into multiple output formats.
The project covers capabilities for generating configuration data from templates, eliminating duplicate configuration values through inheritance and self-references, and creating parameterized functions that return objects or values for modular and DRY configuration logic. It includes tools for converting YAML to Jsonnet templates and managing Kubernetes object collections through object-based mappings. The system can produce output in JSON, YAML, INI, XML, and Python literal formats from a single template source.
Jsonnet is available through a C API for host program integration and a Python API for evaluating templates directly from Python code.