Skip to content

Instantly share code, notes, and snippets.

@l1x
Last active August 24, 2022 21:53
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save l1x/5deee8e9e3df81a4d31c504d5a7007fb to your computer and use it in GitHub Desktop.
Python 3 version of converting JSON to YAML one liner
python -c 'import sys, yaml, json; j=json.loads(sys.stdin.read()); print(yaml.safe_dump(j))'
# on windows(PS):
# Get-Content example.json | python -c 'import sys, yaml, json; j=json.loads(sys.stdin.read()); print(yaml.safe_dump(j))' > example.yaml
# on Unix clones
# python -c 'import sys, yaml, json; j=json.loads(sys.stdin.read()); print(yaml.safe_dump(j)) < example.json > example.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment