I have a notepad file which I save as a json file and I'm trying to read it in pandas dataframe.
My json file looks like this:
{
"date" : "2000-01-01",
"i" : "1387",
"xxx" : "aaaa",
},
{
"fecha" : "2000-01-02",
"indicativo" : "1387",
"xxx" : "aaaa",
},
{
"data" : "2000-01-03",
"indicativo" : "1387",
},
{
"date" : "2000-01-04",
"i" : "1387",
"xxx" : "aaaa",
},
{
"fecha" : "2000-01-05",
"indicativo" : "1387",
"xxx" : "aaaa",
}
How can I change this to the correct json format using code? (Keep in mind that I just posted some lines, the actual json file is hundreds of hundreds of lines so it is impractical for me to do it manually)
And then once I have that file the code would be:
import pandas as pd
from pandas.io.json import json_normalize
name = pd.read_json(r"file.json", lines=True, orient='records')
I tried running the above code with the json file but kept getting :
ValueError: Expected object or value.
After much trial and error I believe it is due to the fact the it is not in correct json format so I would appreciate if someone helps me with at least the first part.