Jsonnet

  • It is an extension of JSON language
  • Any valid JSON language is automatically JSONNET
  • It adds:
    • Variables
    • Conditionals
    • Arithmetic
    • Functions
    • Imports
    • Error Propagation
    • Object Orientation

Import

  • import is like copying pasting code from another file
  • Files designed for import by convention end with .libsonnet
  • Raw json can also be imported
  • importstr is used to import UTF-8 text
  • importbin is used to import binary data

Error

  • To raise error: error "foo"

Convert jsonnet to json

  • You can use jsonnet command to show json output in console
jsonnet test.jsonnet