I just study json in python. Let's say I have a data like:
{
"id":1,
"class":"c1",
"owner":"myself",
"metadata":{
"m1":{
"value":"m1_1",
"timestamp":"d1"
},
"m2":{
"value":"m1_2",
"timestamp":"d2"
},
"m3":{
"value":"m1_3",
"timestamp":"d3"
},
"m4":{
"value":"m1_4",
"timestamp":"d4"
}
},
"a1":{
"a11":[
]
},
"m1":{
},
"comm1":"COMM1",
"comm2":"COMM21529089656387",
"share":"xxx",
"share1":"yyy",
"hub1":"h1",
"hub2":"h2",
"context":[
]
}
I am wondering how I can convert such json to csv when it includes multiple nests.
I hope the csv structure can include all the fields, such as:
id class owner metadata-m1-value metadata-m2-value ......
1 c1 myself m1_1 m1_2......
I do not understand json very well. so maybe my example is not very good. Anyway, showing all the fields in csv. If you think there is a better way to do this, please use your way.
I searched Pandas read nested json. But json is really new to me and I cannot get the point.