json-repair 0.15.3__tar.gz → 0.15.4__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.15.3/src/json_repair.egg-info → json_repair-0.15.4}/PKG-INFO +1 -1
- {json_repair-0.15.3 → json_repair-0.15.4}/pyproject.toml +1 -1
- {json_repair-0.15.3 → json_repair-0.15.4}/src/json_repair/json_repair.py +12 -4
- {json_repair-0.15.3 → json_repair-0.15.4/src/json_repair.egg-info}/PKG-INFO +1 -1
- {json_repair-0.15.3 → json_repair-0.15.4}/tests/test_json_repair.py +2 -1
- {json_repair-0.15.3 → json_repair-0.15.4}/LICENSE +0 -0
- {json_repair-0.15.3 → json_repair-0.15.4}/README.md +0 -0
- {json_repair-0.15.3 → json_repair-0.15.4}/setup.cfg +0 -0
- {json_repair-0.15.3 → json_repair-0.15.4}/src/json_repair/__init__.py +0 -0
- {json_repair-0.15.3 → json_repair-0.15.4}/src/json_repair.egg-info/SOURCES.txt +0 -0
- {json_repair-0.15.3 → json_repair-0.15.4}/src/json_repair.egg-info/dependency_links.txt +0 -0
- {json_repair-0.15.3 → json_repair-0.15.4}/src/json_repair.egg-info/top_level.txt +0 -0
- {json_repair-0.15.3 → json_repair-0.15.4}/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.15.
|
6
|
+
version = "0.15.4"
|
7
7
|
license = {file = "LICENSE"}
|
8
8
|
authors = [
|
9
9
|
{ name="Stefano Baccianella", email="4247706+mangiucugna@users.noreply.github.com" },
|
@@ -226,10 +226,18 @@ class JSONParser:
|
|
226
226
|
lstring_delimiter = rstring_delimiter = string_quotes
|
227
227
|
# There is sometimes a weird case of doubled quotes, we manage this also later in the while loop
|
228
228
|
if self.get_char_at(1) == lstring_delimiter:
|
229
|
-
self.
|
230
|
-
|
231
|
-
|
232
|
-
|
229
|
+
next_next_char = self.get_char_at(2) or ""
|
230
|
+
if not next_next_char.isspace() and next_next_char not in [
|
231
|
+
",",
|
232
|
+
":",
|
233
|
+
"]",
|
234
|
+
"}",
|
235
|
+
]:
|
236
|
+
self.log(
|
237
|
+
"While parsing a string, we found a doubled quote, ignoring it",
|
238
|
+
"info",
|
239
|
+
)
|
240
|
+
self.index += 1
|
233
241
|
char = self.get_char_at()
|
234
242
|
if char != lstring_delimiter:
|
235
243
|
self.log(
|
@@ -108,10 +108,11 @@ def test_repair_json():
|
|
108
108
|
assert repair_json('{"key\t\_": "value"}') == '{"key\\t_": "value"}'
|
109
109
|
assert repair_json('{""answer"":[{""traits"":''Female aged 60+'',""answer1"":""5""}]}') == '{"answer": [{"traits": "Female aged 60+", "answer1": "5"}]}'
|
110
110
|
assert repair_json('{""answer":[{""traits":""Female aged 60+",""answer1":""5"}]}') == '{"answer": [{"traits": "Female aged 60+", "answer1": "5"}]}'
|
111
|
-
assert repair_json('{"key":""
|
111
|
+
assert repair_json('{"key":""') == '{"key": ""}'
|
112
112
|
assert repair_json('{ "words": abcdef", "numbers": 12345", "words2": ghijkl" }') == '{"words": "abcdef", "numbers": 12345, "words2": "ghijkl"}'
|
113
113
|
assert repair_json('{"key": 1/3}') == '{"key": "1/3"}'
|
114
114
|
assert repair_json('{"key": .25}') == '{"key": 0.25}'
|
115
|
+
assert repair_json("""{ "a": "", "b": [ { "c": 1} ] \n}```""") == '{"a": "", "b": [{"c": 1}]}'
|
115
116
|
|
116
117
|
|
117
118
|
def test_repair_json_with_objects():
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|