I am a beginner in python. I'm trying to create a dictionary in a JSON file that I created before. This dictionary must contain the geometrical TYPE of the elements that I retrieve via an API. I tried with the following code but I have the following error message:
with open(filename) as json_file:
data_raw = json.load(json_file)
data_events = dict(type=data_raw['type'], features=[])
The API looks like this :
...
"geometry":{
"type":"Point",
"coordinates":[
2.900875,
48.550178
]
},
...
the error I have :
Traceback (most recent call last):
File "<string>", line 25, in <module>
KeyError: 'type'
What should i do?