is there a quick way to convert bunch of yaml files to json files. I looked at yaml2json and it is not working (throws some exception)
Thanks
Adding answer because there's no answer for the latest version for yq (except in comments).
brew install yq
yq -j eval test.yaml
Or, newer syntax:
yq -o=json eval test.yml
Use the real yq (not python yq) from https://github.com/mikefarah/yq
brew reinstall yq
Then run:
/usr/local/bin/yq eval deployment.yaml -o=json -P > deployment.json
Meaning of the arguments, from --help
:
-P, --prettyPrint pretty print, shorthand for '... style = ""'
-o, --output-format string [yaml|y|json|j|props|p|xml|x] output format type. (default "yaml")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With