MCPcopy
hub / github.com/pyload/pyload / raw_decode

Method raw_decode

module/lib/simplejson/decoder.py:408–421  ·  view source on GitHub ↗

Decode a JSON document from ``s`` (a ``str`` or ``unicode`` beginning with a JSON document) and return a 2-tuple of the Python representation and the index in ``s`` where the document ended. This can be used to decode a JSON document from a string that may have extra

(self, s, idx=0)

Source from the content-addressed store, hash-verified

406 return obj
407
408 def raw_decode(self, s, idx=0):
409 """Decode a JSON document from ``s`` (a ``str`` or ``unicode``
410 beginning with a JSON document) and return a 2-tuple of the Python
411 representation and the index in ``s`` where the document ended.
412
413 This can be used to decode a JSON document from a string that may
414 have extraneous data at the end.
415
416 """
417 try:
418 obj, end = self.scan_once(s, idx)
419 except StopIteration:
420 raise JSONDecodeError("No JSON object could be decoded", s, idx)
421 return obj, end

Callers 1

decodeMethod · 0.95

Calls 1

JSONDecodeErrorClass · 0.85

Tested by

no test coverage detected