1 year ago
#364005
Ang
Flatten nested json from API in python with id outside string
How can I flatten this json and create a table with the id presented in the table ?
Json file structure as below is present as a string in a large table
id | date | json |
---|---|---|
cell 1 | 2022-04-01 | json string as below |
cell 2 | 2022-04-01 | json string as below |
[
{
"a": {
"b": [
{
"c": "1",
"d": "2",
"e": "3",
"f": "4"
}
]
},
"g": {
"h": "5",
"i": "6"
}
}
]
I have tried below yet it doens't seem to split it correctly.
pd.DataFrame(pd.json_normalize(df,record_path=["a","b"],["g"]))
I am expecting a data frame that i can work with
python
json
flatten
unnest
0 Answers
Your Answer