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