I have uploaded a file here that I am trying to parse as JSON, but my code below is not working:
with open('all_links_dict.json') as fd:
json_data = json.load(fd)
print(json_data)
I have uploaded a file here that I am trying to parse as JSON, but my code below is not working:
with open('all_links_dict.json') as fd:
json_data = json.load(fd)
print(json_data)
Copyright © 2021 Jogjafile Inc.
If you have a trailing ',' in the file, then it must also be removed. The following code tests if for the comma and removes it (later I will show you something simpler and better):
Using
jsonUsing
ast.literal_evalIn this case we don't have to worry about a possible trailing ','.
Update
If the above code is still not working, you can find the offending lines with: