JSONStream is python library that enables parsing distinct JSON objects from an input stream
from StringIO import StringIO
from JSONStream import JSONStream
cities = StringIO('''
{"name": "London"}
{"name": "Milan"}
{"name": "New york"}
{"name": "Paris"}
''')
for city in JSONStream(cities):
print(city["name"])
If the above data is stored in a file. We can do the following
import JSONStream import JSONStream
with open('cities.json') as cities:
for city in JSONStream(cities):
print(city["name"])