google/jsonnet

C api should expose jsonnet types

Opened this issue · 2 comments

To embbed jsonnet in an application as a config language, you often want it to produce a traversable structure. Right now you can evaluate and then reinterpret the char* with a different json parser which is painful:

https://github.com/mikedanese/overlay/blob/master/main.c#L195-L206

It looks like this is what JsonnetJsonValue is intended to be?

Yeah I was thinking that jsonnet_execute_snippet and friends should return a JsonnetJsonValue instead of a string so you don't have to parse it back again. Although that does go against the direction we've previously talked about with custom manifesters that always return string (for -S, --yaml-stream, and similar applications). In that case you always manifest in Jsonnet so the client should receive a string, not the intermediate JSON.