Reputation: 5
I am making a Python Script which fetches JSON from an endpoint and then writes it to a CSV, however I keep getting this error when trying to write a specific key. What should I do?
My code and the error I am receiving
What I am aiming to have in the end
Upvotes: 0
Views: 461
Reputation: 45
Results is a list of dictionaries. try doing Results[0].keys() instead
Upvotes: 1
Reputation: 156
"Results" is of type list
and not dict
.
Therefore, you can't treat it like a dictionary and invoke keys()
I guess what you want to do is remove the '[' ']' from "Results" in your json file
Upvotes: 0