I try to save my data (type list of dictionaries) in a json file but this error was raised.
for i in range(0,len(data_sentences)):
data_dic = {}
data_dic["sentence"] = data_sentences[i]
data_dic["aspect"] = data_attributes[i]
data_dic["polarity"] = data_sentiments[i]
data.append(data_dic)
with open(jsonname+'.json', 'w') as outfile:
json.dump(data, outfile)
The error was like:
TypeError: Object of type 'time' is not JSON serializable
But weirdly the json file was generated correctly. After Googleing I only found solutions to datatime which seems irrelevant.
Any tips will be appreciated!