Babel in Jsonnet with ob-jsonnet.el

emacs jsonnet org

I made some org-babel functions for Jsonnet and it was pretty easy!

ob-template.el is a great starting point and made for light work.

Install #

Download ob-jsonnet.el to somewhere in your load path and add

(require 'ob-jsonnet)

And append (jsonnet . t) to org-babel-load-languages.

You may customize org-babel-jsonnet-command if the jsonnet command is not in your $PATH.

Examples #

Basic usage

#+begin_src jsonnet :exports both :wrap "src json"
{a:42}
#+end_src
{
   "a": 42
}

You can also supply command line options:

#+begin_src jsonnet :cmdline "-S" :exports both :wrap "example"
std.join(" ", ["hello","world"])
#+end_src
hello world

Now, if only we had proper syntax highlighting for Jsonnet in Hugo.