Skip to content

Instantly share code, notes, and snippets.

@xbalaji
Last active September 5, 2019 22:54
Show Gist options
  • Save xbalaji/2e8d262dbacf3d120394981143b173a7 to your computer and use it in GitHub Desktop.
Save xbalaji/2e8d262dbacf3d120394981143b173a7 to your computer and use it in GitHub Desktop.
xml to yaml python one-liner
cat "xml-file" | python3 -c 'import sys,xmltodict,yaml,json; print(yaml.dump(json.loads(json.dumps(xmltodict.parse(sys.stdin.read())))))'
aws ec2 describe-vpn-connections | jq -r '.VpnConnections[].CustomerGatewayConfiguration' | python3 -c 'import sys,xmltodict,yaml,json; print(yaml.dump(json.loads(json.dumps(xmltodict.parse(sys.stdin.read())))))'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment