(json_string)
| 30 | return False |
| 31 | |
| 32 | def refine_json(json_string): |
| 33 | json_string = json_string.strip().replace('\r', '').replace('\t', '').replace('\n', '').replace('\\', '') |
| 34 | |
| 35 | json_string = re.sub(r',\s*([}\]])', r'\1', json_string) |
| 36 | json_string = re.sub(r'\.\s*([}\]])', r'\1', json_string) |
| 37 | |
| 38 | pattern = r"\{(.*)\}" |
| 39 | match = re.search(pattern, json_string, re.DOTALL) |
| 40 | |
| 41 | if match: |
| 42 | json_string = "{" + match.group(1) + "}" |
| 43 | if check_json(json_string): |
| 44 | return json_string |
| 45 | else: |
| 46 | return json_string |
| 47 | |
| 48 | return json_string |
| 49 | |
| 50 | |
| 51 | def parse_semi_formatted_json(json_string): |
no test coverage detected