Skip to content Skip to sidebar Skip to footer

Digging Down Json File

I have been trying in many ways (and by many questions in stackoverflow) to normalize a deep json file. I have tried with .apply(pd.Series), not great with many levels of dictionar

Solution 1:

I guess I figured out how to 'dig' through a json. It will depend if the next level is a list or a dict.

In my case I was able to dig until the end with below. I still need to find out how to use the full list (maybe loop) so I can have all values and not just [0] or [1].

raw['hits']['hits'][1]['_source']['authors'][0]['affiliations']

Solution 2:

Can you try this :

json_normalize(raw['hits'],'hits','_source','authors','affiliations')

Post a Comment for "Digging Down Json File"