NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #3308 most downloaded on PyPI
Python bindings for Jsonnet - The data templating language
Last release 6 months ago
24 Mar 2026
Release timing varies
gaps range from 2 weeks to 1.9 years
Most releases are documented
notes for 31 of 35 stable releases
Nothing withdrawn
no release was ever pulled
11 years old
68 releases · first in 2015
The Python module can be found at https://pypi.org/project/jsonnet/0.22.0/
The Python module can be found at https://pypi.org/project/jsonnet/0.22.0/
Updates since release candidate 1
Language changes, new features, etc
1_500_000) (#1160)std.isNull (#1237)--help output (#1206)jsonnetfmt CLI now prints the names of any input files that are changed or not cleanly formatted, when running in --test or --in-place modes (#1303)jsonnet CLI now knows a flag --no-trailing-newline - this disables the final newline that is normally included in the output of any Jsonnet evaluation. This option is also added to the Jsonnet API (see doc comments in libjsonnet.h, libjsonnet++.h) (#1283)Bug fixes:
std.objectRemoveKey has been re-implemented to fix several bugs and unexpected behaviours (#1269)<<, >>) implementation now avoids undefined behaviour.std.parseYaml have been fixed (#1148, #1292, #1293)std.makeArray (if they are type-compatible) (#511, #1299, #1307)std.flatMap now has better type checking of its arguments (#1226)Build systems, testing, CI, internal:
abi3 compatible wheels, improving compatibility with new Python versions (#1289)Full commit history: v0.21.0...v0.22.0
One column per quarter.
Language changes, new features, etc
Language changes, new features, etc
1_500_000) (#1160)std.isNull (#1237)--help output (#1206)jsonnetfmt CLI now prints the names of any input files that are changed or not cleanly formatted, when running in --test or --in-place modes (#1303)jsonnet CLI now knows a flag --no-trailing-newline - this disables the final newline that is normally included in the output of any Jsonnet evaluation. This option is also added to the Jsonnet API (see doc comments in libjsonnet.h, libjsonnet++.h) (#1283)Bug fixes:
std.objectRemoveKey has been re-implemented to fix several bugs and unexpected behaviours (#1269)<<, >>) implementation now avoids undefined behaviour.std.parseYaml have been fixed (#1148, #1292, #1293)std.makeArray (if they are type-compatible) (#511, #1299)std.flatMap now has better type checking of its arguments (#1226)Build systems, testing, CI, internal:
abi3 compatible wheels, improving compatibility with new Python versions (#1289)Full commit history: v0.21.0...v0.22.0-rc1
Full Changelog: v0.21.0...v0.22.0-rc1
A release, after (slightly over) 2 years since v0.20.0.
A release, after (slightly over) 2 years since v0.20.0.
A corresponding PyPI package is published at: https://pypi.org/project/jsonnet/0.21.0/
|||- to cause a trailing newline to be trimmed. (#289)Full Changelog: v0.20.0...v0.21.0
What's changed since 0.21.0-rc1
This is the first release candidate for v0.21.0. Since this is the first release for jsonnet for nearly 2 years, and since the build systems and packa
This is the first release candidate for v0.21.0. Since this is the first release for jsonnet for nearly 2 years, and since the build systems and packaging tools have changed somewhat since the last release, this release candidate is being published first to give an opportunity for jsonnet users to report any major build breakage or other problems that would make the release fundamentally unusable.
A corresponding PyPI package is published at: https://pypi.org/project/jsonnet/0.21.0rc1/
|||- to cause a trailing newline to be trimmed. (#289)Full Commit list: v0.20.0...v0.21.0-rc1
This release has a bug fix for std.member on strings ( google/go-jsonnet#656 )
This release has a bug fix for std.member on strings (google/go-jsonnet#656)
std.escapeStringXMLstd.sumstd.xorstd.xnorstd.isEmptystd.roundstd.objectKeysValues (convert an object to a list of pairs)std.objectKeysValuesAlljsonnet-deps and jsonnet-lint are now included in releases
Nothing published for this version
The previous v0.19.0 release had a small change in the C bindings to allow importbin to function, but missing from the release notes was mention of th
The previous v0.19.0 release had a small change in the C bindings to allow importbin to function, but missing from the release notes was mention of the fact that the Python bindings had also changed in a similar way - to require the content of the file to be provided as a bytes type instead of a str. To convert from str to bytes, simply call .encode() on the str.
In order to write Python code that works for both Jsonnet versions, the Jsonnet version is now provided as a field of the _jsonnet module, which allows writing code like the following:
import _jsonnet
import semver
import_returns_bytes = semver.compare(getattr(_jsonnet, 'version', 'v0.18.0')[1:], '0.18.0') > 0
def no_nl_eof(directory, rel):
if import_returns_bytes:
return "foo.jsonnet", b"42"
else:
return "foo.jsonnet", "42"
_jsonnet.evaluate_snippet("test.jsonnet", "{\nlocal foo = import 'foo.jsonnet',\n \n 'bar': foo\n }\n", import_callback=no_nl_eof)
This release also fixes an off-by-one truncation error in the import callback logic of the Python bindings introduced in the previous release. This was only noticeable if the imported file had no trailing \n, or if you were using importbin with a Python import callback.
importbin feature for loading binary files
In order to support importbin, it was necessary to change the C API for import callbacks so that
they can return arbitrary binary blobs (that can contain \0) as opposed to just strings. This
change is not binary compatible with previous versions of libjsonnet. If you build against
libjsonnet.h and you use import callbacks then you will have to make a small adjustment to your
code.
The emscripten build rules are now gone.
Fixed memory leak in libjsonnet++.cpp
Fixed lack of jsonnet_realloc in Go C bindings
There are many more native implementations of library functions on the Go side, resulting in better
performance for Jsonnet code calling those library functions.
Nothing published for this version
The Jsonnet website now uses a WASM build of go-jsonnet for its online demos instead of an emscripten build of the C++ implementation. This is part of
std.stripCharsstd.objectGetOrDefault and std.objectGetOrDefaultAllquote_keys parameter for std.manifestYamlDocstd.manifestTomlstd.manifestJsonMinifiedstd.parseYamlNothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
We no longer treat fake names for ad hoc snippets or extvars as paths. Function family EvaluateSnippet* is now deprecated in favor of EvaluateAnonymou…
< now works on arrays and performs lexicographic comparison.std.objectValues and std.objectValuesAll for getting an array on field values.jsonnet-lint which automatically finds common problems in Jsonnet programs.jsonnet-deps which finds all transitive dependencies.std.manifestJsonEx is now much faster.std.flatMap (in addition to arrays).EvaluateSnippet* is now deprecated in favor of EvaluateAnonymousSnippet* or EvaluateFile*.go_repository rule for go-jsonnet.std.rstripCharsstd.slice.tests.sh script for go-jsonnet no longer refreshes cpp-jsonnet submodule.Nothing published for this version
It is now allowed to have positional parameters after named ones
jsonnetfmt implementation in Go was added.gojsonnet using pip. It is a source package, so a reasonably recent Go toolchain is required to install it.<< and >>) by negative exponent is a runtime error now.Nothing published for this version
std.stripChars, std.lstripChars, std.stripChars
Nothing published for this version
Object field caching - now each field is evaluated only once for each object. This may drastically improve performance in many cases.
jsonnetfmt -i no longer modifies timestamps of properly formatted files.Nothing published for this version
jsonnet fmt is now its own executable called jsonnetfmt. This helps if you're using the Go version but you still want to have a formatter in your $PAT
jsonnet fmt is now its own executable called jsonnetfmt. This helps if you're using the Go version but you still want to have a formatter in your $PATH. Soon we want to have jsonnetfmt be a binary in the Go version too.
If you've got scripts that run jsonnet fmt, you will need to delete the space from them.
Standard library additions:
There are some performance improvements in the Go version
There are are also plenty of minor bugfixes.
Nothing published for this version
Nothing published for this version
Identical to v0.12.0 except fixed Pypi package manifest
Identical to v0.12.0 except fixed Pypi package manifest
Nothing published for this version
Fix std.parseHex that rejected certain correct inputs
Stdlib changes:
std.parseHex that rejected certain correct inputsstd.find and std.findSubstrstd.parseJsonPerformance:
std.join, std.splitLimit, std.substr, std.range std.strReplace, std.asciiLower, std.asciiUpperPython
Go
Nothing published for this version
Note: v0.11.0 and v0.11.1 are the same as this release, but are botched due to mismatches in golden test files.
Note: v0.11.0 and v0.11.1 are the same as this release, but are botched due to mismatches in golden test files.
Language changes:
stdlib improvements:
C++ Implementation changes:
Go Implementation changes:
Nothing published for this version
Nothing published for this version
Eventually, we would like to deprecate the C++ version, since the Go version has simpler source code (benefiting from go routines and the native garba…
The formatter (jsonnet fmt) is now more opinionated, in that more features are enabled by default. This means if you habitually use it to format your Jsonnet code, it may change them significantly after this release (hence the major version bump). We recommend reformatting your code to match these new defaults, but the old behavior is still available via:
jsonnet fmt -n 0 --string-style l --comment-style l --no-sort-imports
After a quiet ramp up, we're announcing the Go port. It is a complete re-implementation in Go, therefore it is more suitable for running untrusted Jsonnet code server-side. It is feature complete and will generate the same JSON and the only differences you might see are with some of the error messages and trace backs. We think it is ready for general use, and many projects are already using it.
You should stop using the cgo wrapper now!
Eventually, we would like to deprecate the C++ version, since the Go version has simpler source code (benefiting from go routines and the native garbage collector). However the formatter is still only available in C++ Jsonnet.
https://github.com/google/go-jsonnet
{ [null]: true for x in [3] } now respects the null instead of being an errorstd.strReplace(str, from, to)std.isArray(v), std.isBoolean(v), std.isFunction(v), std.isNumber(v), std.isObject(v), std.isString(v)std.sign(n)std.asciiUpper(x), std.asciiLower(x)std.manifestYamlDoc(value), std.manifestYamlStream(value)std.manifestXmlJsonml(value) (see jsonml.org)...and minor bug fixes & performance improvements.
Nothing published for this version
One major change: Import paths now are properly escaped. This was originally an oversight and went unnoticed because people don't usually use backslas
One major change: Import paths now are properly escaped. This was originally an oversight and went unnoticed because people don't usually use backslashes in their paths. On Windows, we recommend using the verbatim string literals to avoid having to escape the path separator, e.g., import @"c:\foo.jsonnet".
Remaining changes are minor:
Nothing published for this version
There are two new operators e in e and e in super. They perform the same role as std.objectHasAll, i.e. they allow you to discover whether a field exi
Major changes:
There are two new operators e in e and e in super. They perform the same role as std.objectHasAll, i.e. they allow you to discover whether a field exists, except that std.objectHasAll(super, e) cannot be expressed since super is not allowed in isolation. The semantics of e in super are quite interesting because it returns false even if there is no super object.
There is a subtle change to the semantics of +: and related field definitions. Previously if the super-object did not have the field f then f +: e was an error. Now, it succeeds in that case yielding f: e. This extends recursively, so { } + { f+: { x +: { y: 1 } } } yields { f: { x: { y: 1 } } }, and in fact the left hand side { } is not even needed. You can evaluate a mixin like { f+: { x +: { y: 1 } } } without even applying it to anything. This is a backwards compatible change because it only affects the behavior of programs that used to fail.
Minor other changes in this release:
Nothing published for this version
Nothing published for this version
Nothing published for this version
Sorry for the churn. Since the last release a buffer overrun was identified, so this release fixes it. Also included are some fixes to jsonnet fmt beh
Sorry for the churn. Since the last release a buffer overrun was identified, so this release fixes it. Also included are some fixes to jsonnet fmt behavior and a fix for [e::] when e was larger than one token.
error will implicitly convert to string
New features:
Bug fixes:
Fixed the binding of self / super in e after the expansion of [e] +: Several improvements to the output of jsonnet fmt when -n is used. Avoid an infinite loop of memory consumption at a ||| syntax error.
Fix a segfault in the GC when using native functions.
Fix a segfault in the GC when using native functions.
Some minor bug fixes.
Imported values are now cached after execution, resulting in a ~2x performance improvement (measured on some real Jsonnet code).
This release renames all "library" jsonnet files to .libsonnet as proposed some months ago. This is just a convention, it does not affect evaluation o
This release renames all "library" jsonnet files to .libsonnet as proposed some months ago. This is just a convention, it does not affect evaluation of Jsonnet configs. As with all conventions, users can adopt it... or ignore it :)
This release also has some new language features:
As in Python, you can provide default arguments to functions, e.g.
local add(x, y=3) = x + y;
add(6)
and also bind arguments to parameters by name instead of by position:
add(x=6)
The syntax and semantics matches Python but without _args and *_kwargs.
This is a more principled way of parameterizing an entire config. Previously the only way to do that was with std.extVar, but this created a global variable of sorts. Code anywhere in the config could use it and it in large configs this can become a maintenance hurdle. std.extVar still exists but there is a new way where the parameter is scoped only to the main or root file of the config, and has to be explicitly threaded to imported files:
Previously a Jsonnet file evaluating to a function would be rejected:
$ jsonnet -e 'function() 42'
RUNTIME ERROR: Couldn't manifest function in JSON output.
Now, such a function is called with no arguments to yield the value that is manifested as JSON. To add arguments, use the new commandline parameters.
Available options for specifying values of 'top-level arguments':
Provide the value as a string:
-A / --tla-str <var>[=<val>] If <val> is omitted, get from environment var <var>
--tla-str-file <var>=<file> Read the string from the file
Provide a value as Jsonnet code:
--tla-code <var>[=<code>] If <code> is omitted, get from environment var <var>
--tla-code-file <var>=<file> Read the code from the file
$ jsonnet -e 'function(a, b, c=3) a + b + c' --tla-code a=1 --tla-code b=2
6
Note that TLAs provide default arguments for the entire config, something that was not possible (but often requested) with std.extVar().
Now you can, via the C API (or wrappers, e.g. Python) add your own native functions to Jsonnet. The purpose of these functions is to expose tricky functionality that you wouldn't want to implement in Jsonnet. E.g. compression, or encryption. Note that these functions must be pure. They must have no side-effects and must give the same return value for the same input. Since Jsonnet is a lazy language, native functions may be called at unusual times, in an unusual order, more times than expected, or not at all. If the functionality being exposed is not naturally pure (e.g. random secret generation), please wrap it in a cache so that subsequent calls with the same params give the same result.
Currently native extensions can have an arbitrary number of parameters but each has to be a primitive (i.e. not an object or an array). One option for now is to wrap the native function in Jsonnet code that calls std.toString() on the value, then parse the JSON on the host language side.
Native extensions can however return arbitrary JSON objects.
Firstly, Jsonnet users should be aware of a tiny non-backwards-compatible change: It is no longer possible to put spaces or comments between the chara
Firstly, Jsonnet users should be aware of a tiny non-backwards-compatible change: It is no longer possible to put spaces or comments between the characters of each of the following operators :: +: ::: and +::: . The fact this was ever possible was an accident of implementation. In fact, we expect no-one was actually writing code like { x: /*foo */: 3 }.
With that out of the way, let's talk about the many new features this release:
The major announcement is the Jsonnet reformatter, which is in many ways like the Go reformatter, including the way it is invoked:
jsonnet fmt foo.jsonnet
(See --help for more details.)
This tool will clean up whitespace, re-indent, and use syntax sugars where possible. It can control the way strings are quoted and the comment style. However it will not (yet) break or join lines. It is quite extensible so please submit issues for more things you think it should fix. An obvious candidate is alphabetic re-ordering of imports!
One thing for which it's very useful is the process of bootstrapping unformatted JSON code into beautiful Jsonnet. To do this, use a standard JSON reformatter like json_pp to line-break the JSON how you want. Then run jsonnet fmt on it to strip the quotes from field names where possible and put commas on the end of lines. That takes care of the most boring aspects of refactoring JSON into Jsonnet!
Another new feature is to add Python style array slicing. This is the ability to do
local arr = ['it', 'was', 'the', 'best', 'of', 'times'];
assert arr[2:4] == ['the', 'best'];
assert arr[1::2] == ['was', 'best', 'times'];
true
This is designed to be compatible with Python, except the ability to use negative numbers to refer to elements relative to the far end of the array. The rationale: We'd rather have an explicit error to catch broken index arithmetic, and you can always use std.length() when you (rarely) need to refer to the last element of an array.
Did you notice the last example used ' for string literals instead of the " as prescribed by JSON? This new kind of string literal is useful in cases when you want to embed " in your string without escaping. It also has a bit less visual clutter.
Another innovation is --yaml-stream, which was implemented primarily for easy output into kubectl (from the Kubernetes project). The idea is that the Jsonnet script manifests into a JSON array, and this is rendered as a "YAML stream". For more context see yaml.org.
$ jsonnet --yaml-stream -e '[{ animal: "dog", sound: "woof" }, { animal: "cat", sound: "meow" }]'
---
{
"animal": "dog",
"sound": "woof"
}
---
{
"animal": "cat",
"sound": "meow"
}
...
The final new feature: We now have JSON merge patch support (RFC7396) in the standard library.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Aside from minor improvements and bug fixes, this release has one change to the language that is not compatible with previous versions.
Aside from minor improvements and bug fixes, this release has one change to the language that is not compatible with previous versions.
Some users pointed out that import "foo" + bar had surprising behavior, because it looks like it will compute the name of the import, but in actual fact it is parsed as (import "foo") + bar, which converts the imported Jsonnet file to a string, then appends bar to it. In order to avoid that confusion, we've make the parentheses mandatory in those cases.
The vast majority of imports, which are unambiguous, are not affected. For example:
local foo = import "foo";
This release also fixes the compilation of Jsonnet during pip install.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Fix the Python release (again).
Fix the Python release (again).
Nothing published for this version
The last release was broken on Python so this fixes that. It also fixes a bug with decoding high unicode codepoints.
The last release was broken on Python so this fixes that. It also fixes a bug with decoding high unicode codepoints.
Adds unicode support (finally fixing #1)
This release:
Your coding agent can read these notes before it upgrades. Set up the MCP server →