Skip to content Skip to sidebar Skip to footer

Access Field In Json Data

I have an API response in the following JSON format. If I want to extract a field, such as geocode, how would I do so? Is it redundant to put the response in JSON? I get an error s

Solution 1:

Error is in the hierarchy that you use here:

json.loads(data['features']['id'][0]['properties'][0]['geocode'][0])

Correct one would be:

json.loads(data['features'][0]['properties']['geocode'])

Post a Comment for "Access Field In Json Data"