Last active
October 22, 2021 02:07
-
-
Save relaxdiego/6ad236492003b6225274123284883916 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
# | |
# Usage: ./yaml-to-json.sh | jq . | |
# | |
file=$1 | |
if ! pip show pyyaml >/dev/null; then | |
echo "PyYAML needs to be installed" | |
exit 1 | |
fi | |
python3 -c "import sys,yaml,json; print(json.dumps(yaml.safe_load(sys.stdin)))" < "$file" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment