![]() |
VOOZH | about |
07 March 2021
I was looking for a one-liner to convert between JSON and YAML in the shell and I came across yq. In short it’s…
# yml -> json
yq eval -j sample.yml
# json -> yml
yq eval -P sample.json
The flags are -j for --tojson and -P for --prettyPrint.
There are various ways to install it including on mac: brew install yq
It supports the convention of using - as the filename to read from stdin, which allows us to string together the pbpaste and pbcopy commands on OSX to convert JSON or YML in your clipboard to the other format.
# clipboard yml -> json
pbpaste | yq eval -j - | pbcopy
# clipboard json -> yml
pbpaste | yq eval -P - | pbcopy
is a software engineer living in NYC who is building
Superset 💪
and also created
GoFullPage 📸
more »
github · soundcloud · rss
mrcoles.com © 2026