I have as an output from my Python script a JSon format and I want to write the JSon into a file.
I use
df_json.to_json(orient='records')
with open('JSONData.json', 'w') as f:
json.dump(df_json, f)
I have the following error:
raise TypeError(repr(o) + " is not JSON serializable")
[1746 rows x 2 columns] is not JSON serializable
I don't know what I am doing wrong.
My JSon output is as follows :
[
{
"id": 1,
"results": [
1,
2,
3
]
},
{
"id": 558599,
"results": [
4,
5,
6
]
}
]
Thank you in advance.