json-repair 0.41.1__py3-none-any.whl → 0.42.0__py3-none-any.whl
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/json_parser.py +6 -2
- {json_repair-0.41.1.dist-info → json_repair-0.42.0.dist-info}/METADATA +1 -1
- {json_repair-0.41.1.dist-info → json_repair-0.42.0.dist-info}/RECORD +7 -7
- {json_repair-0.41.1.dist-info → json_repair-0.42.0.dist-info}/WHEEL +1 -1
- {json_repair-0.41.1.dist-info → json_repair-0.42.0.dist-info}/entry_points.txt +0 -0
- {json_repair-0.41.1.dist-info → json_repair-0.42.0.dist-info}/licenses/LICENSE +0 -0
- {json_repair-0.41.1.dist-info → json_repair-0.42.0.dist-info}/top_level.txt +0 -0
json_repair/json_parser.py
CHANGED
@@ -10,7 +10,6 @@ JSONReturnType = Union[Dict[str, Any], List[Any], str, float, int, bool, None]
|
|
10
10
|
class JSONParser:
|
11
11
|
# Constants
|
12
12
|
STRING_DELIMITERS = ['"', "'", "“", "”"]
|
13
|
-
NUMBER_CHARS = set("0123456789-.eE/,")
|
14
13
|
|
15
14
|
def __init__(
|
16
15
|
self,
|
@@ -663,7 +662,8 @@ class JSONParser:
|
|
663
662
|
number_str = ""
|
664
663
|
char = self.get_char_at()
|
665
664
|
is_array = self.context.current == ContextValues.ARRAY
|
666
|
-
|
665
|
+
NUMBER_CHARS = set("0123456789-.eE/,")
|
666
|
+
while char and char in NUMBER_CHARS and (not is_array or char != ","):
|
667
667
|
number_str += char
|
668
668
|
self.index += 1
|
669
669
|
char = self.get_char_at()
|
@@ -671,6 +671,10 @@ class JSONParser:
|
|
671
671
|
# The number ends with a non valid character for a number/currency, rolling back one
|
672
672
|
number_str = number_str[:-1]
|
673
673
|
self.index -= 1
|
674
|
+
elif (self.get_char_at() or "").isalpha():
|
675
|
+
# this was a string instead, sorry
|
676
|
+
self.index -= len(number_str)
|
677
|
+
return self.parse_string()
|
674
678
|
try:
|
675
679
|
if "," in number_str:
|
676
680
|
return str(number_str)
|
@@ -1,14 +1,14 @@
|
|
1
1
|
json_repair/__init__.py,sha256=c4L2kZrHvWEKfj_ODU2naliNuvU6FlFVxtF0hbLe6s8,178
|
2
2
|
json_repair/__main__.py,sha256=EsJb-y89uZEvGQQg1GdIDWzfDwfOMvVekKEtdguQXCM,67
|
3
3
|
json_repair/json_context.py,sha256=mm6dOyrPJ1sDskTORZSXCW7W9-5veMlUKqXQ3Hw3EG4,971
|
4
|
-
json_repair/json_parser.py,sha256=
|
4
|
+
json_repair/json_parser.py,sha256=bu8FBxaazJ_tRJQmdZA7Me68HD7t3JuReVgjvyGWbmQ,39174
|
5
5
|
json_repair/json_repair.py,sha256=k-5HRRlCqrxNmJi0u1KE3IUeL4HXqi1XZ7oAL-NFDLo,10314
|
6
6
|
json_repair/object_comparer.py,sha256=SeicB6_N4BHAEPon7s2BELEaJc4oyR9ZhfX2RgPk6Bw,1682
|
7
7
|
json_repair/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
8
|
json_repair/string_file_wrapper.py,sha256=koZmdq2-Z5K7XF1bDqX6dEbNaVMJYcMTjq-aGe6NQvA,4526
|
9
|
-
json_repair-0.
|
10
|
-
json_repair-0.
|
11
|
-
json_repair-0.
|
12
|
-
json_repair-0.
|
13
|
-
json_repair-0.
|
14
|
-
json_repair-0.
|
9
|
+
json_repair-0.42.0.dist-info/licenses/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
|
10
|
+
json_repair-0.42.0.dist-info/METADATA,sha256=XJXQxqg6znbpuxK1hTY_0v3FB4KtH_8gOMPD-u_EdvY,11860
|
11
|
+
json_repair-0.42.0.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
|
12
|
+
json_repair-0.42.0.dist-info/entry_points.txt,sha256=SNfge3zPSP-ASqriYU9r3NAPaXdseYr7ciPMKdV2uSw,57
|
13
|
+
json_repair-0.42.0.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
|
14
|
+
json_repair-0.42.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|