I have a number of use-cases that have accreted over the last 7 years that involve generating parameterized JSON. I'm running in many production applications a stupidly heterogeneous collection of JSON templating utilities, evolving as my my understanding of the problem and the complexity requirements has increased. From string substitution to
mustache templating to a custom
Jackson ObjectCodec to
Jolt transformations to lists of JSONPath expressions... culminating in an unholy monstrosity that uses a patched
Spring Expression Language engine to compile JSON templates into Java bytecode. Don't get me wrong, the current solution is *fast*, but it's... inelegant.
So I have been looking for a cleaner solution, one that I can use inside Kafka Streams (on the JVM), Elasticsearch Plugins (also on the JVM), Storm bolts (again JVM), inside an Oracle database (Java stored procedures), and many more.
I have two goals; one short term, and one more ambitious.
First, I want to be able to use Jsonnet as a java library, inside Java applications, and (for example) write JSON templates that call Java code that can accept a Jsonnet object comprehension that can execute a Java function to get data... and so on. Complete interoperability between jsonnet and java.
When I can pass 100% of the unit tests, I'll consider that goal complete.
Second, I want to implement the Jsonnet in
Truffle. This will allow Jsonnet templates to be compiled directly into bytecode, and then using
Graal, directly into native executables. I'm not sure yet exactly how this will use useful, but maybe someone one day would like to be able to embed a Jsonnet template in their Ruby or R or Rust code or whatever.