Skip to content

Latest commit

 

History

History
36 lines (24 loc) · 631 Bytes

File metadata and controls

36 lines (24 loc) · 631 Bytes

JSONStream

JSONStream is python library that enables parsing distinct JSON objects from an input stream

Example Usage

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"])