Skip to content

Instantly share code, notes, and snippets.

@dkdndes
Forked from noahcoad/yaml2json.py
Created March 17, 2017 13:50
Show Gist options
  • Save dkdndes/f293c45abbdbcea7a2c3468fe4f31ad5 to your computer and use it in GitHub Desktop.
Save dkdndes/f293c45abbdbcea7a2c3468fe4f31ad5 to your computer and use it in GitHub Desktop.
Python to Convert yaml to json
# convert yaml to json
# pip3 install pyyaml
# http://pyyaml.org/wiki/PyYAMLDocumentation
# py3 yaml2json.py < ~/code/manpow/homeland/heartland/puphpet/config.yaml
# gist https://gist.github.com/noahcoad/51934724e0896184a2340217b383af73
import yaml, json, sys
sys.stdout.write(json.dumps(yaml.load(sys.stdin), sort_keys=True, indent=2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment