Created
June 10, 2019 20:28
-
-
Save sr75/0288c635a4d3745840a296f1adbf6a32 to your computer and use it in GitHub Desktop.
yaml2json python bash alias one liner
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
# https://medium.com/@frontman/how-to-parse-yaml-string-via-command-line-374567512303 | |
alias yaml2json="python3 -c 'import sys,json,yaml;f=open(sys.argv[1]);d=yaml.safe_load(f);f.close();print(json.dumps(d))'" | |
# yaml2json ./vars.yml | jq ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment