Simple JSON loading from `data`.
(data: str)
| 7 | |
| 8 | |
| 9 | def load_prefixed_json(data: str) -> Tuple[str, json.JSONDecoder]: |
| 10 | """Simple JSON loading from `data`. |
| 11 | |
| 12 | """ |
| 13 | # First, the full data. |
| 14 | try: |
| 15 | return '', load_json_preserve_order_and_dupe_keys(data) |
| 16 | except ValueError: |
| 17 | pass |
| 18 | |
| 19 | # Then, try to find the start of the actual body. |
| 20 | data_prefix, body = parse_prefixed_json(data) |
| 21 | try: |
| 22 | return data_prefix, load_json_preserve_order_and_dupe_keys(body) |
| 23 | except ValueError: |
| 24 | raise ValueError('Invalid JSON') |
| 25 | |
| 26 | |
| 27 | def parse_prefixed_json(data: str) -> Tuple[str, str]: |
no test coverage detected