MCPcopy Index your code
hub / github.com/RustPython/RustPython / raw_decode

Method raw_decode

Lib/json/decoder.py:365–378  ·  view source on GitHub ↗

Decode a JSON document from ``s`` (a ``str`` 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 extraneous data at t

(self, s, idx=0)

Source from the content-addressed store, hash-verified

363 return obj
364
365 def raw_decode(self, s, idx=0):
366 """Decode a JSON document from ``s`` (a ``str`` beginning with
367 a JSON document) and return a 2-tuple of the Python
368 representation and the index in ``s`` where the document ended.
369
370 This can be used to decode a JSON document from a string that may
371 have extraneous data at the end.
372
373 """
374 try:
375 obj, end = self.scan_once(s, idx)
376 except StopIteration as err:
377 raise JSONDecodeError("Expecting value", s, err.value) from None
378 return obj, end

Callers 1

decodeMethod · 0.95

Calls 1

JSONDecodeErrorClass · 0.85

Tested by

no test coverage detected