I have a large json file (about 11,600 records) and I am trying to parse it using ijson. However, the for loop breaks because of one faulty json record. Is there a way to continue the iteration by skipping that record and moving on using ijson or any other python library? Here's the code snippet.
try:
for row in ijson.items(json_file, 'rows.item'):
data = row
try:
super_df=dependency_latest_version(data, version)
except Exception as e:
print(e)
except ijson.common.IncompleteJSONError:
traceback.print_exc()
This generates the following error:
for row in ijson.items(json_file, 'rows.item'):
ijson.common.IncompleteJSONError: parse error: after array element, I expect ',' or ']'
dmeFilename":"README.md"}}":{"integrity":"sha512-204Fg2wwe1Q
(right here) ------^
I tried iterating through the json file line by line and then using json.loads(line) but it didn't help since the entire json file was being read as a single line. Are there any other alternatives? Thank you.