Skip to content

Instantly share code, notes, and snippets.

@Exceen
Forked from sbp/json2yaml.sh
Created August 11, 2018 20:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Exceen/318e4b4092d25f01e08db2b491355ad6 to your computer and use it in GitHub Desktop.
Save Exceen/318e4b4092d25f01e08db2b491355ad6 to your computer and use it in GitHub Desktop.
Convert JSON to YAML
#!/bin/sh
export PYTHONPATH=$HOME/usr/opt/pyyaml/lib/python2.6/site-packages
python -c '
import sys, json, yaml
with open(sys.argv[1]) as f:
print yaml.safe_dump(json.load(f), default_flow_style=False)
' $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment