Return the Python representation of ``s`` (a ``str`` or ``unicode`` instance containing a JSON document)
(self, s, _w=WHITESPACE.match, _PY3=PY3)
| 387 | self.scan_once = make_scanner(self) |
| 388 | |
| 389 | def decode(self, s, _w=WHITESPACE.match, _PY3=PY3): |
| 390 | """Return the Python representation of ``s`` (a ``str`` or ``unicode`` |
| 391 | instance containing a JSON document) |
| 392 | |
| 393 | """ |
| 394 | if _PY3 and isinstance(s, bytes): |
| 395 | s = str(s, self.encoding) |
| 396 | obj, end = self.raw_decode(s) |
| 397 | end = _w(s, end).end() |
| 398 | if end != len(s): |
| 399 | raise JSONDecodeError("Extra data", s, end, len(s)) |
| 400 | return obj |
| 401 | |
| 402 | def raw_decode(self, s, idx=0, _w=WHITESPACE.match, _PY3=PY3): |
| 403 | """Decode a JSON document from ``s`` (a ``str`` or ``unicode`` |
no test coverage detected