Skip to content

Instantly share code, notes, and snippets.

@sr75
Created June 10, 2019 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sr75/0288c635a4d3745840a296f1adbf6a32 to your computer and use it in GitHub Desktop.
Save sr75/0288c635a4d3745840a296f1adbf6a32 to your computer and use it in GitHub Desktop.
yaml2json python bash alias one liner
# 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