talira

Jsonnet

A configuration language for app and tool developers

open sourceApache-2.0free

Jsonnet is a data templating language from Google: a superset of JSON with variables, functions, conditionals, imports and object inheritance, which evaluates to JSON and can also output YAML, INI and other text formats. It's a side-effect-free, lazily evaluated, dynamically typed functional language with object-oriented features, used to cut duplication in sprawling configuration such as Kubernetes manifests and Terraform or Packer files. Google maintains two official interpreters tested against the same suite, the original in C++ and a newer, generally faster one in Go (which also has a linter), plus the jsonnetfmt formatter, library bindings and a formal specification. Apache-2.0 licensed.

Libraries for Jsonnet

Talira doesn't list any yet.

Problems it solves

  • stop copying the same Kubernetes YAML across environments
  • generate JSON or YAML config from templates with functions and inheritance
  • a configuration language that's a superset of JSON
  • which config language should we use for our deployment manifests
  • share common config between many services without copy and paste
  • generate Grafana dashboards or Prometheus rules as code

Features

  • superset of JSON with variables, functions, conditionals and imports
  • object inheritance and mixins to remove duplication
  • output JSON, YAML, INI and other text formats
  • side-effect-free, lazily evaluated
  • official C++ and Go interpreters tested against one suite
  • jsonnetfmt formatter and a linter (Go build)
  • formal specification and standard library

Capabilities

Has a command line toolplan not known

Alternatives

The same job

These do what Jsonnet does.

  1. Nickel Better configuration for less
  2. HCL The HashiCorp configuration language
  3. Pkl A configuration-as-code language with rich validation and tooling
  4. KCL An open-source constraint-based record and functional language for configuration and policy
  5. CUE Validate, define, and use dynamic and text-based data
  6. Starlark A Python dialect designed as a configuration language, made for Bazel

Compare Jsonnet with the top 3