json-repair 0.29.7__tar.gz → 0.29.8__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {json_repair-0.29.7/src/json_repair.egg-info → json_repair-0.29.8}/PKG-INFO +1 -1
- {json_repair-0.29.7 → json_repair-0.29.8}/pyproject.toml +1 -1
- {json_repair-0.29.7 → json_repair-0.29.8}/src/json_repair/json_parser.py +8 -0
- {json_repair-0.29.7 → json_repair-0.29.8/src/json_repair.egg-info}/PKG-INFO +1 -1
- {json_repair-0.29.7 → json_repair-0.29.8}/tests/test_json_repair.py +1 -0
- {json_repair-0.29.7 → json_repair-0.29.8}/LICENSE +0 -0
- {json_repair-0.29.7 → json_repair-0.29.8}/README.md +0 -0
- {json_repair-0.29.7 → json_repair-0.29.8}/setup.cfg +0 -0
- {json_repair-0.29.7 → json_repair-0.29.8}/src/json_repair/__init__.py +0 -0
- {json_repair-0.29.7 → json_repair-0.29.8}/src/json_repair/__main__.py +0 -0
- {json_repair-0.29.7 → json_repair-0.29.8}/src/json_repair/json_context.py +0 -0
- {json_repair-0.29.7 → json_repair-0.29.8}/src/json_repair/json_repair.py +0 -0
- {json_repair-0.29.7 → json_repair-0.29.8}/src/json_repair/py.typed +0 -0
- {json_repair-0.29.7 → json_repair-0.29.8}/src/json_repair/string_file_wrapper.py +0 -0
- {json_repair-0.29.7 → json_repair-0.29.8}/src/json_repair.egg-info/SOURCES.txt +0 -0
- {json_repair-0.29.7 → json_repair-0.29.8}/src/json_repair.egg-info/dependency_links.txt +0 -0
- {json_repair-0.29.7 → json_repair-0.29.8}/src/json_repair.egg-info/entry_points.txt +0 -0
- {json_repair-0.29.7 → json_repair-0.29.8}/src/json_repair.egg-info/top_level.txt +0 -0
- {json_repair-0.29.7 → json_repair-0.29.8}/tests/test_coverage.py +0 -0
- {json_repair-0.29.7 → json_repair-0.29.8}/tests/test_performance.py +0 -0
@@ -3,7 +3,7 @@ requires = ["setuptools>=61.0"]
|
|
3
3
|
build-backend = "setuptools.build_meta"
|
4
4
|
[project]
|
5
5
|
name = "json_repair"
|
6
|
-
version = "0.29.
|
6
|
+
version = "0.29.8"
|
7
7
|
license = {file = "LICENSE"}
|
8
8
|
authors = [
|
9
9
|
{ name="Stefano Baccianella", email="4247706+mangiucugna@users.noreply.github.com" },
|
@@ -291,6 +291,7 @@ class JSONParser:
|
|
291
291
|
# * It iterated over the entire sequence
|
292
292
|
# * If we are fixing missing quotes in an object, when it finds the special terminators
|
293
293
|
char = self.get_char_at()
|
294
|
+
unmatched_delimiter = False
|
294
295
|
while char and char != rstring_delimiter:
|
295
296
|
if (
|
296
297
|
missing_quotes
|
@@ -377,6 +378,11 @@ class JSONParser:
|
|
377
378
|
"In a string with missing quotes and object value context, I found a delimeter but it turns out it was the beginning on the next key. Stopping here.",
|
378
379
|
)
|
379
380
|
break
|
381
|
+
elif unmatched_delimiter:
|
382
|
+
unmatched_delimiter = False
|
383
|
+
string_acc += str(char)
|
384
|
+
self.index += 1
|
385
|
+
char = self.get_char_at()
|
380
386
|
else:
|
381
387
|
# Check if eventually there is a rstring delimiter, otherwise we bail
|
382
388
|
i = 1
|
@@ -430,6 +436,7 @@ class JSONParser:
|
|
430
436
|
self.log(
|
431
437
|
"While parsing a string, we misplaced a quote that would have closed the string but has a different meaning here since this is the last element of the object, ignoring it",
|
432
438
|
)
|
439
|
+
unmatched_delimiter = not unmatched_delimiter
|
433
440
|
string_acc += str(char)
|
434
441
|
self.index += 1
|
435
442
|
char = self.get_char_at()
|
@@ -459,6 +466,7 @@ class JSONParser:
|
|
459
466
|
self.log(
|
460
467
|
"While parsing a string, we a misplaced quote that would have closed the string but has a different meaning here, ignoring it",
|
461
468
|
)
|
469
|
+
unmatched_delimiter = not unmatched_delimiter
|
462
470
|
string_acc += str(char)
|
463
471
|
self.index += 1
|
464
472
|
char = self.get_char_at()
|
@@ -106,6 +106,7 @@ def test_missing_and_mixed_quotes():
|
|
106
106
|
assert repair_json('{"foo": "\\"bar\\""') == '{"foo": "\\"bar\\""}'
|
107
107
|
assert repair_json('{"" key":"val"') == '{" key": "val"}'
|
108
108
|
assert repair_json('{"key": value "key2" : "value2" ') == '{"key": "value", "key2": "value2"}'
|
109
|
+
assert repair_json('{"key": "lorem ipsum ... "sic " tamet. ...}') == '{"key": "lorem ipsum ... \\"sic \\" tamet. ..."}'
|
109
110
|
|
110
111
|
def test_array_edge_cases():
|
111
112
|
assert repair_json("[1, 2, 3,") == "[1, 2, 3]"
|
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
|