def iterjson(text):
    """Decode JSON stream."""
    decoder = json.JSONDecoder()
    while text:
        obj, ndx = decoder.raw_decode(text)

        if not isinstance(obj, dict):
            raise ValueError()

        text = text[ndx:].lstrip('\r\n')
        yield obj
def iterjson ( text ) : decoder = json . JSONDecoder ( ) while text : obj , ndx = decoder . raw_decode ( text ) if not isinstance ( obj , dict ) : raise ValueError ( ) text = text [ ndx : ] . lstrip ( '\r\n' ) yield obj
Decode JSON stream.