Re:Jsonnet – The Data Templating Language
by GlickWick on Monday March 27, 2023 @01:18PM
(#35329416)
My employer (who I don’t speak for) used this for a long time. Im not normally particularly opinionated about tech choice, but I can very strongly say do not use jsonnet unless you enjoy adding an esoteric unsupported language to your job configs for no reason.
[ Parent
| on HN ]
What would you use instead?
Re:Jsonnet – The Data Templating Language
by techhazard on Monday March 27, 2023 @04:17PM
(#35331849)
Not OP, but I can highly recommend just using the programming language you already use to make key-value map to and then converting that to JSON. That way you only have 1 syntax to worry about. In my case that’s Python (using dictionaries and json.dumps)
You could also try for a templating framework (like jinja2) but then you have 3 syntaxes colliding: the programming language you call the templating engine with (e.g. Python for jinja2) the templating language itself (e.g. jinja2) and then JSON as well.
This works for some languages but not others (some typed languages are particularly ill-suited to the problem of writing CLI tools to dump heterogenous dictionaries and/or objects with many optional fields)
Re:Jsonnet – The Data Templating Language
by GlickWick on Tuesday March 28, 2023 @10:56AM
(#35342115)
Assuming you need something beyond basic JSON, a well-understood scripting language like JS or Python. Bazel if you want something more build-focused.
> do not do X for no reason.
You are not contributing much here. Could you elaborate what problems they were trying to solve and what other problems were met?