I have a .txt file with 70+k json object obtained by pulling data from twitter and dumping into file using:
with open("followers.txt", 'a') as f:
for follower in limit_handled(tweepy.Cursor(api.followers, screen_name=account_name).pages()):
for user_obj in follower:
json.dump(user_obj._json, f)
f.write("\n")
When I try to read this in python using the code below:
import json
with open('followers.txt') as json_data:
follower_data = json.load(json_data)
I get error:
ValueError: Extra data: line 2 column 1 - line 2801 column 1 (char 1489 - 8679498)
It worked when I read a test file with one json object copied from the original file using the same code above. Once I add a second json object to this file then using the same code above gives the error:
ValueError: Extra data: line 2 column 1 - line 2 column 2376 (char 1489 - 3864)
How do I read the file with more than one json object?