json-repair 0.30.3__tar.gz → 0.31.0__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {json_repair-0.30.3/src/json_repair.egg-info → json_repair-0.31.0}/PKG-INFO +1 -1
- {json_repair-0.30.3 → json_repair-0.31.0}/pyproject.toml +1 -1
- {json_repair-0.30.3 → json_repair-0.31.0}/src/json_repair/json_parser.py +14 -1
- {json_repair-0.30.3 → json_repair-0.31.0/src/json_repair.egg-info}/PKG-INFO +1 -1
- {json_repair-0.30.3 → json_repair-0.31.0}/tests/test_json_repair.py +2 -1
- {json_repair-0.30.3 → json_repair-0.31.0}/LICENSE +0 -0
- {json_repair-0.30.3 → json_repair-0.31.0}/README.md +0 -0
- {json_repair-0.30.3 → json_repair-0.31.0}/setup.cfg +0 -0
- {json_repair-0.30.3 → json_repair-0.31.0}/src/json_repair/__init__.py +0 -0
- {json_repair-0.30.3 → json_repair-0.31.0}/src/json_repair/__main__.py +0 -0
- {json_repair-0.30.3 → json_repair-0.31.0}/src/json_repair/json_context.py +0 -0
- {json_repair-0.30.3 → json_repair-0.31.0}/src/json_repair/json_repair.py +0 -0
- {json_repair-0.30.3 → json_repair-0.31.0}/src/json_repair/py.typed +0 -0
- {json_repair-0.30.3 → json_repair-0.31.0}/src/json_repair/string_file_wrapper.py +0 -0
- {json_repair-0.30.3 → json_repair-0.31.0}/src/json_repair.egg-info/SOURCES.txt +0 -0
- {json_repair-0.30.3 → json_repair-0.31.0}/src/json_repair.egg-info/dependency_links.txt +0 -0
- {json_repair-0.30.3 → json_repair-0.31.0}/src/json_repair.egg-info/entry_points.txt +0 -0
- {json_repair-0.30.3 → json_repair-0.31.0}/src/json_repair.egg-info/top_level.txt +0 -0
- {json_repair-0.30.3 → json_repair-0.31.0}/tests/test_coverage.py +0 -0
- {json_repair-0.30.3 → json_repair-0.31.0}/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.
|
6
|
+
version = "0.31.0"
|
7
7
|
license = {file = "LICENSE"}
|
8
8
|
authors = [
|
9
9
|
{ name="Stefano Baccianella", email="4247706+mangiucugna@users.noreply.github.com" },
|
@@ -322,11 +322,24 @@ class JSONParser:
|
|
322
322
|
else:
|
323
323
|
# OK but this could still be some garbage at the end of the string
|
324
324
|
# So we need to check if we find a new lstring_delimiter afterwards
|
325
|
-
# If we do, this is a missing delimiter
|
325
|
+
# If we do, maybe this is a missing delimiter
|
326
326
|
i = self.skip_to_character(character=lstring_delimiter, idx=i)
|
327
|
+
if doubled_quotes:
|
328
|
+
i = self.skip_to_character(
|
329
|
+
character=lstring_delimiter, idx=i
|
330
|
+
)
|
327
331
|
next_c = self.get_char_at(i)
|
328
332
|
if not next_c:
|
329
333
|
rstring_delimiter_missing = False
|
334
|
+
else:
|
335
|
+
# But again, this could just be something a bit stupid like "lorem, "ipsum" sic"
|
336
|
+
# Check if we find a : afterwards (skipping space)
|
337
|
+
i = self.skip_whitespaces_at(
|
338
|
+
idx=i + 1, move_main_index=False
|
339
|
+
)
|
340
|
+
next_c = self.get_char_at(i)
|
341
|
+
if next_c and next_c != ":":
|
342
|
+
rstring_delimiter_missing = False
|
330
343
|
else:
|
331
344
|
# There could be a case in which even the next key:value is missing delimeters
|
332
345
|
# because it might be a systemic issue with the output
|
@@ -108,6 +108,7 @@ def test_missing_and_mixed_quotes():
|
|
108
108
|
assert repair_json('{"key": value "key2" : "value2" ') == '{"key": "value", "key2": "value2"}'
|
109
109
|
assert repair_json('{"key": "lorem ipsum ... "sic " tamet. ...}') == '{"key": "lorem ipsum ... \\"sic \\" tamet. ..."}'
|
110
110
|
assert repair_json('{"key": value , }') == '{"key": "value"}'
|
111
|
+
assert repair_json('{"comment": "lorem, "ipsum" sic "tamet". To improve"}') == '{"comment": "lorem, \\"ipsum\\" sic \\"tamet\\". To improve"}'
|
111
112
|
|
112
113
|
def test_array_edge_cases():
|
113
114
|
assert repair_json("[1, 2, 3,") == "[1, 2, 3]"
|
@@ -135,7 +136,7 @@ def test_object_edge_cases():
|
|
135
136
|
assert repair_json('{"value_1": true, COMMENT "value_2": "data"}') == '{"value_1": true, "value_2": "data"}'
|
136
137
|
assert repair_json('{"value_1": true, SHOULD_NOT_EXIST "value_2": "data" AAAA }') == '{"value_1": true, "value_2": "data"}'
|
137
138
|
assert repair_json('{"" : true, "key2": "value2"}') == '{"": true, "key2": "value2"}'
|
138
|
-
assert repair_json(
|
139
|
+
assert repair_json("""{""answer"":[{""traits"":''Female aged 60+'',""answer1"":""5""}]}""") == '{"answer": [{"traits": "Female aged 60+", "answer1": "5"}]}'
|
139
140
|
assert repair_json('{ "words": abcdef", "numbers": 12345", "words2": ghijkl" }') == '{"words": "abcdef", "numbers": 12345, "words2": "ghijkl"}'
|
140
141
|
assert repair_json('''{"number": 1,"reason": "According...""ans": "YES"}''') == '{"number": 1, "reason": "According...", "ans": "YES"}'
|
141
142
|
assert repair_json('''{ "a" : "{ b": {} }" }''') == '{"a": "{ b"}'
|
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
|