Parsing Through Nested Json Python
data = response.json() sortJson = json.dumps(data, sort_keys=True, indent=2, separators=(',', ':')) result = json.loads (data) print (''saleTotal':', result['trips
Solution 1:
tripOption
and pricing
are lists of objects, if you take that into account it will work:
print ('"saleTotal":', result['trips']['tripOption'][0]['pricing'][0]['saleTotal'])
Output:
"saleTotal": USD54.00
Post a Comment for "Parsing Through Nested Json Python"