Decode JSON stream.
421662
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
535637
def reader(stream):
    """"""
    string = stream.read()
    decoder = json.JSONDecoder().raw_decode
    index = START.match(string, 0).end()

    while index < len(string):
        obj, end = decoder(string, index)
        item = Item()
        item.primitive = obj
        yield item
        index = END.match(string, end).end()
820910
def from_json(cls, json):
    """"""
    return cls(json[cls.BLOB_KEY_PARAM],
               json[cls.INITIAL_POSITION_PARAM],
               json[cls.END_POSITION_PARAM])
496961
protected String readJsonFrom(final InputStream json) throws IOException {
        return isJsonFormat()
            ? JsonValue.readHjson(IOUtils.toString(json, StandardCharsets.UTF_8)).toString()
            : String.join("\n", IOUtils.readLines(json, StandardCharsets.UTF_8));
    }
433432
def read_json(self):
        
        line = self.stdin.readline()
        if line == '':
            raise EOFError()
        return json.loads(line)
702840
def _bytes_from_json(value, field):
    """"""
    if _not_null(value, field):
        return base64.standard_b64decode(_to_bytes(value))
1314954
def decode_json_body():
    
    raw_data = request.body.read()

    try:
        return json.loads(raw_data)
    except ValueError as e:
        raise HTTPError(400, e.__str__())
1254012
def json(self):
        """"""
        if hasattr(self, '_json'):
            return self._json
        try:
            self._json = json.loads(self.text or self.content)
        except ValueError:
            self._json = None
        return self._json
514065
def decode_json(body)
      if body.to_s =~ /^(?:[\d]+|null|true|false)$/
        MultiJson.decode("[#{body}]").first
      else
        MultiJson.decode body
      end
    end
1176733
def json(body, charset='utf-8', **kwargs):
    """"""
    return json_converter.loads(text(body, charset=charset))
1028023
def decode(self):
        """"""
        return serialization.decode(self.body, self.content_type,
                                    self.content_encoding)
693538
def reader(stream):
    """"""
    for line in stream:
        item = Item()
        item.json = line
        yield item
196983
def dump(self):
    """"""
    return json.dumps(
        self.primitive,
        sort_keys=True,
        ensure_ascii=False,
        separators=(',', ':'))
1053716
def load_json_path(path):
    """"""
    with open(path) as handle:
        try: return json.load(handle, object_pairs_hook=collections.OrderedDict)
        except ValueError as error:
            message = "Could not decode JSON file '%s'." % path
            message = "-"*20 + "\n" + message + "\n" + str(error) + "\n" + "-"*20 + "\n"
            sys.stderr.write(message)
            raise error
924189
def toJson(self, data=None, pretty=False):
        """"""
        if data==None: data = self.attrs
        data = self.flatten(data) # don't send objects as str in json
        #if pretty:
        ret = json.dumps(data, indent=4, sort_keys=True)
        #self.inflate() # restore objects from json str data
        return ret
1263866
def json(self):
        """"""
        lines = []
        for line in self.lines():
            try:
                if len(line) == 1:
                    lines.append(json.loads(line, strict=False))
                else:
                    lines.append(json.loads(line[1], strict=False))
            except ValueError:
                pass
        return lines
415643
def load(cls, stream):
        
        data = json.load(stream)['ts']
        return cls(data['time'], data['inc'])