Skip to content

Instantly share code, notes, and snippets.

@chmouel
Created April 24, 2019 23:12
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 chmouel/50b5a61ea9013578130b74946d4e90cd to your computer and use it in GitHub Desktop.
Save chmouel/50b5a61ea9013578130b74946d4e90cd to your computer and use it in GitHub Desktop.
Convert yaml to json via the command line
#!/usr/bin/env bash
[[ -n $1 ]] && from=$1 || from=/dev/stdin
python3 -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sys.stdout, indent=4);print()' < ${from} | jq '.'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment