# Please place these in ~/.bashrc or equivalent yaml2json() { python3 < "${1:-/dev/stdin}" <( cat <<-EOF import sys, yaml, json json.dump(yaml.load(sys.stdin), sys.stdout, indent=4) EOF ) } json2yaml() { python3 < "${1:-/dev/stdin}" <( cat <<-EOF import sys, yaml, json yaml.safe_dump( json.load(sys.stdin), sys.stdout, explicit_start=True, default_flow_style=False ) EOF ) }