Created
June 10, 2019 13:46
-
-
Save Raffaello/c4d6e74b67cadc4ebdcc0cb8995d22e6 to your computer and use it in GitHub Desktop.
yaml2json
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
#!/bin/bash | |
if [ -z "$1" ] | |
then | |
echo "USAGE:" | |
echo "" | |
echo "yaml2json.sh file.yaml" | |
echo "" | |
echo "it will generate the file.yaml.json" | |
exit 1 | |
fi | |
python -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sys.stdout, indent=2)' < $1 > $1.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment