ob-jsonnet enables Org-Babel support for evaluating jsonnet code.
The code is run using the jsonnet command. Libraries can be loaded
by setting the JSONNET_PATH or by providing the :jpaths option
to the code block.
#+begin_src jsonnet :jpaths "path/to/libsonnet"
{
message: libsonnet.sayHello("World"),
}
#+end_src
:
#+results:
: {
: message: "Hello World"
: }
In addition to the normal header arguments for Babel, below are some headers specific to jsonnet.
:jpaths- Relative or absolute paths to jsonnet libraries. Can be defined as a string for a single path or a list of strings for multiple paths.
:varob-jsonnetalso supports Babel variables. Variables are passed using the-Vcommand line option.
#+begin_src jsonnet :jpaths '("path/to/libsonnet" "other/libsonnet")
...
#+end_src
#+begin_src jsonnet :var target="World"
{
message: "Hello %s" % [std.extVar("target")],
}
#+end_src
:
#+results:
: {
: message: "Hello World"
: }