Last active
December 27, 2019 22:46
-
-
Save noahcoad/51934724e0896184a2340217b383af73 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)) |
You left out a colon after mgmt
on the 4th line.
better to use YAMLlint
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi there,
I tried it on the attached yaml file; I got the following issue:
interfaces.yml