Yaml to Jassonnet conversion

313 views
Skip to first unread message

bahram samani

unread,
Oct 12, 2022, 2:28:21 PM10/12/22
to Jsonnet
I have a yaml file that i wan to convert to jsonnet.
But I cannot figure out the command . any idea?


Thank you in advance.

Dave Cunningham

unread,
Oct 13, 2022, 10:12:01 AM10/13/22
to bahram samani, Jsonnet
You can use the javascript tool here: https://jsonnet.org/articles/kubernetes.html

--
You received this message because you are subscribed to the Google Groups "Jsonnet" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jsonnet+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jsonnet/503b308c-a51d-49df-a26b-a29958fc5dd2n%40googlegroups.com.

ca...@xdna.net

unread,
Oct 19, 2022, 8:38:41 AM10/19/22
to Jsonnet
Install gojq: go install github.com/itchyny/gojq/cmd/gojq@latest (or download from the releases page at https://github.com/itchyny/gojq/releases)

Use that to convert yaml to json, then use jsonnetfmt to make the keys nicer:

gojq --yaml-input . < file.yaml | jsonnetfmt - > file.jsonnet

Reply all
Reply to author
Forward
0 new messages