I'm trying to retrieve the area value and the first pair of coordinates value for every area from a JSON list of dictionaries after an API call
[{'area': 'abcd', 'geojson': '{"type":"MultiPolygon","coordinates":[[[[103.8593,1.43905,...[103.6391,1.3527]]]]}'},
{'area': 'efgh', 'geojson': '{"type":"MultiPolygon","coordinates":[[[[100.000,1.4000,...[103.6391,1.3527]]]]}'}
.
.
This is my code
# calling the API
results = requests.get(url).json()
area= []
coordinates = []
for i in results:
a = i['pln_area_n']
area.append(a)
for x in results:
c = x['geojson']['coordinates'][0]
coordinates.append(c)
TypeError: string indices must be integers
My code is definitely wrong, how do I access the first pair of coordinates value of the geojson key for every area?