json-repair 0.52.1__tar.gz → 0.52.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {json_repair-0.52.1/src/json_repair.egg-info → json_repair-0.52.2}/PKG-INFO +1 -1
- {json_repair-0.52.1 → json_repair-0.52.2}/pyproject.toml +1 -1
- {json_repair-0.52.1 → json_repair-0.52.2}/src/json_repair/parse_string.py +11 -0
- {json_repair-0.52.1 → json_repair-0.52.2/src/json_repair.egg-info}/PKG-INFO +1 -1
- {json_repair-0.52.1 → json_repair-0.52.2}/tests/test_parse_object.py +1 -0
- {json_repair-0.52.1 → json_repair-0.52.2}/LICENSE +0 -0
- {json_repair-0.52.1 → json_repair-0.52.2}/README.md +0 -0
- {json_repair-0.52.1 → json_repair-0.52.2}/setup.cfg +0 -0
- {json_repair-0.52.1 → json_repair-0.52.2}/src/json_repair/__init__.py +0 -0
- {json_repair-0.52.1 → json_repair-0.52.2}/src/json_repair/__main__.py +0 -0
- {json_repair-0.52.1 → json_repair-0.52.2}/src/json_repair/constants.py +0 -0
- {json_repair-0.52.1 → json_repair-0.52.2}/src/json_repair/json_context.py +0 -0
- {json_repair-0.52.1 → json_repair-0.52.2}/src/json_repair/json_parser.py +0 -0
- {json_repair-0.52.1 → json_repair-0.52.2}/src/json_repair/json_repair.py +0 -0
- {json_repair-0.52.1 → json_repair-0.52.2}/src/json_repair/object_comparer.py +0 -0
- {json_repair-0.52.1 → json_repair-0.52.2}/src/json_repair/parse_array.py +0 -0
- {json_repair-0.52.1 → json_repair-0.52.2}/src/json_repair/parse_boolean_or_null.py +0 -0
- {json_repair-0.52.1 → json_repair-0.52.2}/src/json_repair/parse_comment.py +0 -0
- {json_repair-0.52.1 → json_repair-0.52.2}/src/json_repair/parse_number.py +0 -0
- {json_repair-0.52.1 → json_repair-0.52.2}/src/json_repair/parse_object.py +0 -0
- {json_repair-0.52.1 → json_repair-0.52.2}/src/json_repair/py.typed +0 -0
- {json_repair-0.52.1 → json_repair-0.52.2}/src/json_repair/string_file_wrapper.py +0 -0
- {json_repair-0.52.1 → json_repair-0.52.2}/src/json_repair.egg-info/SOURCES.txt +0 -0
- {json_repair-0.52.1 → json_repair-0.52.2}/src/json_repair.egg-info/dependency_links.txt +0 -0
- {json_repair-0.52.1 → json_repair-0.52.2}/src/json_repair.egg-info/entry_points.txt +0 -0
- {json_repair-0.52.1 → json_repair-0.52.2}/src/json_repair.egg-info/top_level.txt +0 -0
- {json_repair-0.52.1 → json_repair-0.52.2}/tests/test_json_repair.py +0 -0
- {json_repair-0.52.1 → json_repair-0.52.2}/tests/test_parse_array.py +0 -0
- {json_repair-0.52.1 → json_repair-0.52.2}/tests/test_parse_boolean_or_null.py +0 -0
- {json_repair-0.52.1 → json_repair-0.52.2}/tests/test_parse_comment.py +0 -0
- {json_repair-0.52.1 → json_repair-0.52.2}/tests/test_parse_number.py +0 -0
- {json_repair-0.52.1 → json_repair-0.52.2}/tests/test_parse_string.py +0 -0
- {json_repair-0.52.1 → json_repair-0.52.2}/tests/test_performance.py +0 -0
- {json_repair-0.52.1 → json_repair-0.52.2}/tests/test_repair_json_cli.py +0 -0
- {json_repair-0.52.1 → json_repair-0.52.2}/tests/test_repair_json_from_file.py +0 -0
|
@@ -206,6 +206,17 @@ def parse_string(self: "JSONParser") -> JSONReturnType:
|
|
|
206
206
|
# Check if the object is really over, to avoid doubling the closing brace
|
|
207
207
|
i = self.skip_whitespaces_at(idx=1, move_main_index=False)
|
|
208
208
|
next_c = self.get_char_at(i)
|
|
209
|
+
if next_c and next_c == "`":
|
|
210
|
+
# This could be a special case in which the LLM added code fences after the object
|
|
211
|
+
# So we need to check if there are another two ` after this one`
|
|
212
|
+
next_c = self.get_char_at(i + 1)
|
|
213
|
+
if next_c and next_c == "`":
|
|
214
|
+
next_c = self.get_char_at(i + 2)
|
|
215
|
+
if next_c and next_c == "`":
|
|
216
|
+
self.log(
|
|
217
|
+
"While parsing a string in object value context, we found a } that closes the object before code fences, stopping here",
|
|
218
|
+
)
|
|
219
|
+
break
|
|
209
220
|
if not next_c:
|
|
210
221
|
self.log(
|
|
211
222
|
"While parsing a string in object value context, we found a } that closes the object, stopping here",
|
|
@@ -63,6 +63,7 @@ def test_parse_object_edge_cases():
|
|
|
63
63
|
assert repair_json("{text:words{words in brackets}}") == '{"text": "words{words in brackets}"}'
|
|
64
64
|
assert repair_json("{text:words{words in brackets}m}") == '{"text": "words{words in brackets}m"}'
|
|
65
65
|
assert repair_json('{"key": "value, value2"```') == '{"key": "value, value2"}'
|
|
66
|
+
assert repair_json('{"key": "value}```') == '{"key": "value"}'
|
|
66
67
|
assert repair_json("{key:value,key2:value2}") == '{"key": "value", "key2": "value2"}'
|
|
67
68
|
assert repair_json('{"key:"value"}') == '{"key": "value"}'
|
|
68
69
|
assert repair_json('{"key:value}') == '{"key": "value"}'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|