MCPcopy Index your code
hub / github.com/python/cpython / decode

Method decode

Lib/json/decoder.py:353–362  ·  view source on GitHub ↗

Return the Python representation of ``s`` (a ``str`` instance containing a JSON document).

(self, s, _w=WHITESPACE.match)

Source from the content-addressed store, hash-verified

351
352
353 def decode(self, s, _w=WHITESPACE.match):
354 """Return the Python representation of ``s`` (a ``str`` instance
355 containing a JSON document).
356
357 """
358 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
359 end = _w(s, end).end()
360 if end != len(s):
361 raise JSONDecodeError("Extra data", s, end)
362 return obj
363
364 def raw_decode(self, s, idx=0):
365 """Decode a JSON document from ``s`` (a ``str`` beginning with

Callers 1

loadsFunction · 0.45

Calls 4

raw_decodeMethod · 0.95
_wFunction · 0.85
JSONDecodeErrorClass · 0.85
endMethod · 0.45

Tested by

no test coverage detected