I get End of file expected.json in VS code and "JSON standard allows only one top-level value" in PyCharm , in the json file I am writing in even though the format is exactly the same as another json file that works perfectly fine. Please help me, I cant advance in my project because of this error:(, Here is the code where I write on the json file: `
# you can assume that abs_list is a list of pairs
with open('C:\\Users\\ruben\\Downloads\\NLP_Project-main\\cleanDataCategories.json', 'w') as json_file:
for pair in abs_list:
json_obj = {
"abstract": pair[0],
"category": pair[1]
}
json.dump(json_obj, json_file)
json_file.write('\n')
`
I tried changing this but also didnt work this is really frustrating since I really dont know what could be wrong and feel like is not a problem of the structure or format that json file requires: `
# here I change the "" for '' and i surround the brackets with []
with open('C:\\Users\\ruben\\Downloads\\NLP_Project-main\\cleanDataCategories.json', 'w') as json_file:
for pair in abs_list:
json_obj = [{
'abstract': pair[0],
'category': pair[1]
}]
json.dump(json_obj, json_file)
json_file.write('\n')`