How to convert json to yaml?
+3
−0
How to convert a json file to yaml?
Technically json is already valid yaml, but I'm talking about the characteristic easy-to-read yaml formatting with indentation and minimal quotes.
1 answer
+2
−0
With yq
:
$ yq --output-format yaml . file.json > file.yaml
.
is a filter which is applied to the data, but since .
just stands for the document root, this means that the data is passed through without modification.
yq
is capable of rich document manipulation, but here we are doing just the most simple of operations.
Note that this yq
here is implemented in go. There's also a python project with the same name.
0 comment threads