Spaces:
Sleeping
Sleeping
add extra cleaning part to clean_json_string function
Browse files
app.py
CHANGED
@@ -71,6 +71,9 @@ def clean_json_string(json_str):
|
|
71 |
json_str = re.sub(r"(?<!\\)'([^']*)'", r'"\1"', json_str)
|
72 |
# Add quotes around PASS or FAIL if they're not already quoted
|
73 |
json_str = re.sub(r'"SCORE":\s*(PASS|FAIL)', r'"SCORE": "\1"', json_str)
|
|
|
|
|
|
|
74 |
|
75 |
return json_str
|
76 |
|
|
|
71 |
json_str = re.sub(r"(?<!\\)'([^']*)'", r'"\1"', json_str)
|
72 |
# Add quotes around PASS or FAIL if they're not already quoted
|
73 |
json_str = re.sub(r'"SCORE":\s*(PASS|FAIL)', r'"SCORE": "\1"', json_str)
|
74 |
+
|
75 |
+
# Escape double quotes
|
76 |
+
json_str = re.sub(r'(?<=: ")([^"]*)"([^"]*)"([^"]*)"', lambda m: m.group(1) + m.group(2).replace('"', '\\"') + m.group(3), json_str)
|
77 |
|
78 |
return json_str
|
79 |
|