I have Excel file which I am converting to JSON and merge with existing JSON file. The case is that In Excel I have column "ja" and values in it. IS there a way to add values from that column in JSON, on two places: "ja" and "ja-jpn" Expected output:
"ja":{
"Ball":"Ball",
"Snow":"Schnee",
"Elephant":"Elephant",
"Woman":"Frau",
"Potato":"Kartoffeln",
"Tomato":"F",
"Carrot":"G"
},
"ja-jpa":{
Ball":"Ball",
"Snow":"Schnee",
"Elephant":"Elephant",
"Woman":"Frau",
"Potato":"Kartoffeln",
"Tomato":"F",
"Carrot":"G"
}
CodePudding user response:
Before you convert your dataframe to JSON, just duplicate the column, like this:
if 'ja' in new_data.columns:
new_data['ja-jpn'] = new_data['ja']