json-repair 0.30.1__tar.gz → 0.30.2__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {json_repair-0.30.1/src/json_repair.egg-info → json_repair-0.30.2}/PKG-INFO +1 -3
- {json_repair-0.30.1 → json_repair-0.30.2}/README.md +0 -2
- {json_repair-0.30.1 → json_repair-0.30.2}/pyproject.toml +1 -1
- {json_repair-0.30.1 → json_repair-0.30.2}/src/json_repair/json_parser.py +29 -20
- {json_repair-0.30.1 → json_repair-0.30.2/src/json_repair.egg-info}/PKG-INFO +1 -3
- {json_repair-0.30.1 → json_repair-0.30.2}/tests/test_json_repair.py +1 -0
- {json_repair-0.30.1 → json_repair-0.30.2}/LICENSE +0 -0
- {json_repair-0.30.1 → json_repair-0.30.2}/setup.cfg +0 -0
- {json_repair-0.30.1 → json_repair-0.30.2}/src/json_repair/__init__.py +0 -0
- {json_repair-0.30.1 → json_repair-0.30.2}/src/json_repair/__main__.py +0 -0
- {json_repair-0.30.1 → json_repair-0.30.2}/src/json_repair/json_context.py +0 -0
- {json_repair-0.30.1 → json_repair-0.30.2}/src/json_repair/json_repair.py +0 -0
- {json_repair-0.30.1 → json_repair-0.30.2}/src/json_repair/py.typed +0 -0
- {json_repair-0.30.1 → json_repair-0.30.2}/src/json_repair/string_file_wrapper.py +0 -0
- {json_repair-0.30.1 → json_repair-0.30.2}/src/json_repair.egg-info/SOURCES.txt +0 -0
- {json_repair-0.30.1 → json_repair-0.30.2}/src/json_repair.egg-info/dependency_links.txt +0 -0
- {json_repair-0.30.1 → json_repair-0.30.2}/src/json_repair.egg-info/entry_points.txt +0 -0
- {json_repair-0.30.1 → json_repair-0.30.2}/src/json_repair.egg-info/top_level.txt +0 -0
- {json_repair-0.30.1 → json_repair-0.30.2}/tests/test_coverage.py +0 -0
- {json_repair-0.30.1 → json_repair-0.30.2}/tests/test_performance.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: json_repair
|
3
|
-
Version: 0.30.
|
3
|
+
Version: 0.30.2
|
4
4
|
Summary: A package to repair broken json strings
|
5
5
|
Author-email: Stefano Baccianella <4247706+mangiucugna@users.noreply.github.com>
|
6
6
|
License: MIT License
|
@@ -45,8 +45,6 @@ License-File: LICENSE
|
|
45
45
|
|
46
46
|
This simple package can be used to fix an invalid json string. To know all cases in which this package will work, check out the unit test.
|
47
47
|
|
48
|
-
Inspired by https://github.com/josdejong/jsonrepair
|
49
|
-
|
50
48
|

|
51
49
|
|
52
50
|
---
|
@@ -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.30.
|
6
|
+
version = "0.30.2"
|
7
7
|
license = {file = "LICENSE"}
|
8
8
|
authors = [
|
9
9
|
{ name="Stefano Baccianella", email="4247706+mangiucugna@users.noreply.github.com" },
|
@@ -328,26 +328,35 @@ class JSONParser:
|
|
328
328
|
if not next_c:
|
329
329
|
rstring_delimiter_missing = False
|
330
330
|
else:
|
331
|
-
#
|
332
|
-
|
333
|
-
#
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
#
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
331
|
+
# There could be a case in which even the next key:value is missing delimeters
|
332
|
+
# because it might be a systemic issue with the output
|
333
|
+
# So let's check if we can find a : in the string instead
|
334
|
+
i = self.skip_to_character(character=":", idx=1)
|
335
|
+
next_c = self.get_char_at(i)
|
336
|
+
if next_c:
|
337
|
+
# OK then this is a systemic issue with the output
|
338
|
+
break
|
339
|
+
else:
|
340
|
+
# skip any whitespace first
|
341
|
+
i = self.skip_whitespaces_at(idx=1, move_main_index=False)
|
342
|
+
# We couldn't find any rstring_delimeter before the end of the string
|
343
|
+
# check if this is the last string of an object and therefore we can keep going
|
344
|
+
# make an exception if this is the last char before the closing brace
|
345
|
+
j = self.skip_to_character(character="}", idx=i)
|
346
|
+
if j - i > 1:
|
347
|
+
# Ok it's not right after the comma
|
348
|
+
# Let's ignore
|
349
|
+
rstring_delimiter_missing = False
|
350
|
+
# Check that j was not out of bound
|
351
|
+
elif self.get_char_at(j):
|
352
|
+
# Check for an unmatched opening brace in string_acc
|
353
|
+
for c in reversed(string_acc):
|
354
|
+
if c == "{":
|
355
|
+
# Ok then this is part of the string
|
356
|
+
rstring_delimiter_missing = False
|
357
|
+
break
|
358
|
+
elif c == "}":
|
359
|
+
break
|
351
360
|
if rstring_delimiter_missing:
|
352
361
|
self.log(
|
353
362
|
"While parsing a string missing the left delimiter in object value context, we found a , or } and we couldn't determine that a right delimiter was present. Stopping here",
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: json_repair
|
3
|
-
Version: 0.30.
|
3
|
+
Version: 0.30.2
|
4
4
|
Summary: A package to repair broken json strings
|
5
5
|
Author-email: Stefano Baccianella <4247706+mangiucugna@users.noreply.github.com>
|
6
6
|
License: MIT License
|
@@ -45,8 +45,6 @@ License-File: LICENSE
|
|
45
45
|
|
46
46
|
This simple package can be used to fix an invalid json string. To know all cases in which this package will work, check out the unit test.
|
47
47
|
|
48
|
-
Inspired by https://github.com/josdejong/jsonrepair
|
49
|
-
|
50
48
|

|
51
49
|
|
52
50
|
---
|
@@ -149,6 +149,7 @@ def test_object_edge_cases():
|
|
149
149
|
assert repair_json('{text:words{words in brackets}}') == '{"text": "words{words in brackets}"}'
|
150
150
|
assert repair_json('{text:words{words in brackets}m}') == '{"text": "words{words in brackets}m"}'
|
151
151
|
assert repair_json('{"key": "value, value2"```') == '{"key": "value, value2"}'
|
152
|
+
assert repair_json('{key:value,key2:value2}') == '{"key": "value", "key2": "value2"}'
|
152
153
|
|
153
154
|
def test_number_edge_cases():
|
154
155
|
assert repair_json(' - { "test_key": ["test_value", "test_value2"] }') == '{"test_key": ["test_value", "test_value2"]}'
|
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
|