Google's Jsonnet Language Generates JSON | eWeek

Google’s Jsonnet Language Generates JSON

Google logo
Written By
Darryl K. Taft
Darryl K. Taft
Apr 22, 2015
2 minute read
eWeek content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

Google recently introduced a new open-source configuration language for generating JSON known as Jsonnet.

Google quietly released Jsonnet a few months ago as a programming language for specifying data. The Jsonnet Website calls Jsonnet a data templating language.

Jsonnet doesn’t just generate JSON: It is also an extension of JSON, said Dave Cunningham, a member of Google’s New York Technical Infrastructure team, in a blog post about the new language.

“By adding new constructs between the gaps of existing JSON syntax, Jsonnet adds useful features without breaking backwards compatibility,” Cunningham said. “Any valid JSON is also a valid Jsonnet program that simply emits that JSON unchanged, and existing systems that consume JSON (or its cousin YAML) can be easily modified to accept data in the full Jsonnet language. As such, Jsonnet is an example of a templating language, but one specifically designed for JSON data and less error-prone than other techniques.”

Cunningham also noted that many systems can be configured with JSON, but writing it by hand can be difficult. “Jsonnet is packed with useful data-specification features that expand into JSON for other systems to act upon,” he said.

JSON, or JavaScript Object Notation, is an open standard format that uses human-readable text to transmit data objects consisting of attribute-value pairs. It is used primarily to transmit data between a server and Web application, as an alternative to XML.

Jsonnet is a domain-specific configuration language that helps users define JSON data. It enables users to compute fragments of JSON within the structure, bringing the same benefit to structured data that templating languages bring to plain text.

Cunningham said Jsonnet is a portmanteau of JSON and sonnet. The team selected that name to convey that data expressed in Jsonnet is easier to write and maintain “because it is more elegant and concise, like a poem,” he said. “This is not just due to syntactic niceties like comments and permissive quotes/commas, but because Jsonnet has all the modern multi-paradigm programming language conveniences needed to manage complexity. One key benefit is the ability to use Jsonnet’s mixin and import features to write modular configuration template libraries, allowing the creation of domain-specific configuration languages for particular applications.”

Jsonnet was innovatively conceived using both academic techniques and Google’s own experience implementing production languages, according to Cunningham.

“Unlike most configuration languages, Jsonnet has a full operational semantics, ensuring matching behavior from third-party implementations as well as mathematical analysis,” he said. “It is a very small and carefully chosen extension to JSON that can express both object-oriented and declarative styles.”

Cunningham said that more importantly, unlike regular programming languages, Jsonnet is hermetic, which means its evaluation “is independent of any implicit environmental factors, ensuring that high level configuration will resolve to the same thing every time.”

Jsonnet is available as a library with C and Python bindings, and also as a command line utility.

eWeek Logo

eWeek has the latest technology news and analysis, buying guides, and product reviews for IT professionals and technology buyers. The site's focus is on innovative solutions and covering in-depth technical content. eWeek stays on the cutting edge of technology news and IT trends through interviews and expert analysis. Gain insight from top innovators and thought leaders in the fields of IT, business, enterprise software, startups, and more.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.