'Python - unpacking nested json

I have the following problem: I can not unpack a "Nested JSON"

To obtain this dataset, I used the following code:

 a = pd.json_normalize(variavel, max_level=5)
 a

Nested JSON

Take a look at the last column "node.phases_history". That's the nested json. No matter how many levels I use, I not being able to unpack it.

So, I tried to normalize the column with the nested JSON.

pd.json_normalize(a['node.phases_history'])

And it also does not work, again, no matter how many levels in the max_level I set.

And, when I try it:

pd.json_normalize(a['node.phases_history'][1])

Nested JSON_2

It works, but only for a single registry.

Anyone knows can I solve it, and how I can automate it, no matter how much columns are added?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source