code: def yield_json(stream):
      
      buff = u""
      arr_count = 0
      obj_count = 0
      while True:
          buff += read_chunk(stream)
  
          # If we finish parsing all objs or arrays, yield a finished JSON
          # entity.
          if buff.endswith('{'):
              obj_count += 1
          if buff.endswith('['):
              arr_count += 1
          if buff.endswith(']'):
              arr_count -= 1
              if obj_count == arr_count == 0:
                  json_item = copy(buff)
                  buff = u""
                  yield json_item
          if buff.endswith('}'):
              obj_count -= 1
              if obj_count == arr_count == 0:
                  json_item = copy(buff)
                  buff = u""
                  yield json_item
docs: Uses array and object delimiter counts for balancing.