Problem description :A data set of Arabic Tweets saved in a JSON file but when I try to open this file, I Find nothing. Do you know the solution of this problem.
The first thing to test is that your JSON is valid. I use an online tool:
https://jsonlint.com/
You paste the JSON into their page, and will either say its valid or identify where the problems are.
Once the JSON is confirmed as OK, then this code will load and display it:
import json from pprint import pprint with open('mydata.json') as file: mydata = json.load(file) pprint(mydata)
This works for Python 2.6 and above (earlier versions don't have the with statement). You can also access data items. To see the value associated with myattribute, the code is:
I think you file is not a valid json file or there must be some formatting error in that file. To overcome this problem you should try panda to read the file. Hope that will fix the problem.