I have multiple new line delimited json files (they are nested) and I need to join all of them into one big csv. They all have the same schema (field names).
I have read several solutions on flatten the nest and then append them but I need to append them with a new column saying what file (table) the information comes from.
Table A has
| Column 1 | Column 2 |
|---|---|
| apple | orange |
| Cell 3 | Cell 4 |
Table B has
| Column 1 | Column 2 |
|---|---|
| walmart | target |
| Cell 3 | Cell 4 |
Then the CSV would say
| Column A | Column B | Column C |
|---|---|---|
| TABLE 1 | apple | orange |
| TABLE 2 | walmart | target |
I'm thinking of creating the csv file with different headers like ID, Date, Store, Product then use Insert but I'm not sure on how to do this because most of the tutorials I found only convert json into pandas dataframe.
I have tried to use pd.Dataframe and normalize to try to unnest my json files in order to put it in a dataframe but keep getting into problems. I don't know what to do next. I think it might be because of my json files are not in the right json format? My json file is like this:
{
"idA":{
"property 1": "..."
"property 2": "..."
"property 3": [
{
"A" : "B",
"C" : "D"
}
]
},
"idB":{
.....
}
}
Think of idA and idB are like the id part of an URL, really long. I'm very new and kinda very overwhelmed about this, please help :((