Skip to content

Instantly share code, notes, and snippets.

@Raffaello
Created June 10, 2019 13:46
Show Gist options
  • Save Raffaello/c4d6e74b67cadc4ebdcc0cb8995d22e6 to your computer and use it in GitHub Desktop.
Save Raffaello/c4d6e74b67cadc4ebdcc0cb8995d22e6 to your computer and use it in GitHub Desktop.
yaml2json
#!/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