-
-
Save mclarkson/dbd3f56cefd589cf42b2153eb9742feb to your computer and use it in GitHub Desktop.
Python to Convert yaml to json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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
https://stackoverflow.com/questions/10648614/dump-in-pyyaml-as-utf-8
https://stackoverflow.com/questions/18337407/saving-utf-8-texts-in-json-dumps-as-utf8-not-as-u-escape-sequence