Skip to content

Instantly share code, notes, and snippets.

@akesterson
Created June 12, 2013 22:49
Show Gist options
  • Save akesterson/5769815 to your computer and use it in GitHub Desktop.
Save akesterson/5769815 to your computer and use it in GitHub Desktop.
akesterson@ATLPTLBS3TWW1 ~/source/xml2json
$ ./xml2json.py -t xml2json test.xml |\
head -n 1 |\
python -c 'import dpath.util; import json; import sys; print json.dumps(dpath.util.search(json.loads(sys.stdin.read()), "/ListHostedZonesResponse/HostedZones/HostedZone/[0-3]/Id"), indent=4, sort_keys=True)' 2>&1
{
"ListHostedZonesResponse": {
"HostedZones": {
"HostedZone": [
{
"Id": "/hostedzone/ZM0TA3Q0DI8S1"
},
{
"Id": "/hostedzone/Z1QX71FAUAMBX9"
},
{
"Id": "/hostedzone/Z4GTY66H44QQX"
},
{
"Id": "/hostedzone/Z3UK1H1B3VCNOX"
}
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment