Spaces:
Sleeping
Sleeping
Delete json_dict.py
Browse files- json_dict.py +0 -17
json_dict.py
DELETED
|
@@ -1,17 +0,0 @@
|
|
| 1 |
-
import json
|
| 2 |
-
|
| 3 |
-
def parse_json_response(json_output):
|
| 4 |
-
try:
|
| 5 |
-
# Attempt to parse directly
|
| 6 |
-
return json.loads(json_output)
|
| 7 |
-
except json.JSONDecodeError:
|
| 8 |
-
print("Invalid JSON detected, attempting cleanup...")
|
| 9 |
-
|
| 10 |
-
# Remove problematic characters like backticks
|
| 11 |
-
json_output = json_output.strip("`").replace("\n", "").replace("\t", "")
|
| 12 |
-
|
| 13 |
-
try:
|
| 14 |
-
return json.loads(json_output) # Try parsing again
|
| 15 |
-
except json.JSONDecodeError as e:
|
| 16 |
-
print(f"Final JSON parsing failed: {e}")
|
| 17 |
-
return None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|