I\'m trying to convert a nested JSON to a Pandas dataframe. I\'ve been using json_normalize
with success until I came across a certain JSON. I\'ve made a smalle
I got the KeyError when the structue of the json was not consistent. Meaning, when one of the nested strucutes were missing from the json, I got KeyError.
https://pandas.pydata.org/pandas-docs/stable/generated/pandas.io.json.json_normalize.html
From the examples mentioned on the pandas documentation site, if you make the nested tag (counties) missing on one of the records, you will get a KeyError. To circumvent this, you might have to make sure ignore the missing tag or consider only the records which have nested column/tag populated with data.