json-repair 0.17.2__py3-none-any.whl → 0.17.4__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_repair.py +10 -2
- {json_repair-0.17.2.dist-info → json_repair-0.17.4.dist-info}/METADATA +1 -1
- json_repair-0.17.4.dist-info/RECORD +7 -0
- json_repair-0.17.2.dist-info/RECORD +0 -7
- {json_repair-0.17.2.dist-info → json_repair-0.17.4.dist-info}/LICENSE +0 -0
- {json_repair-0.17.2.dist-info → json_repair-0.17.4.dist-info}/WHEEL +0 -0
- {json_repair-0.17.2.dist-info → json_repair-0.17.4.dist-info}/top_level.txt +0 -0
json_repair/json_repair.py
CHANGED
@@ -113,6 +113,7 @@ class JSONParser:
|
|
113
113
|
# <member> starts with a <string>
|
114
114
|
key = ""
|
115
115
|
while key == "" and self.get_char_at():
|
116
|
+
current_index = self.index
|
116
117
|
key = self.parse_string()
|
117
118
|
|
118
119
|
# This can happen sometimes like { "": "value" }
|
@@ -123,7 +124,8 @@ class JSONParser:
|
|
123
124
|
"info",
|
124
125
|
)
|
125
126
|
break
|
126
|
-
elif key == "":
|
127
|
+
elif key == "" and self.index == current_index:
|
128
|
+
# Sometimes the string search might not move the index at all, that might lead us to an infinite loop
|
127
129
|
self.index += 1
|
128
130
|
|
129
131
|
# We reached the end here
|
@@ -378,14 +380,20 @@ class JSONParser:
|
|
378
380
|
def parse_number(self) -> Union[float, int, str]:
|
379
381
|
# <number> is a valid real number expressed in one of a number of given formats
|
380
382
|
number_str = ""
|
381
|
-
number_chars = set("0123456789-.eE
|
383
|
+
number_chars = set("0123456789-.eE/,")
|
382
384
|
char = self.get_char_at()
|
383
385
|
while char and char in number_chars:
|
384
386
|
number_str += char
|
385
387
|
self.index += 1
|
386
388
|
char = self.get_char_at()
|
389
|
+
if len(number_str) > 1 and number_str[-1] in "-eE/,":
|
390
|
+
# The number ends with a non valid character for a number/currency, rolling back one
|
391
|
+
number_str = number_str[:-1]
|
392
|
+
self.index -= 1
|
387
393
|
if number_str:
|
388
394
|
try:
|
395
|
+
if "," in number_str:
|
396
|
+
return str(number_str)
|
389
397
|
if "." in number_str or "e" in number_str or "E" in number_str:
|
390
398
|
return float(number_str)
|
391
399
|
elif number_str == "-":
|
@@ -0,0 +1,7 @@
|
|
1
|
+
json_repair/__init__.py,sha256=IIzSm1DsCRrr8seF3UeMZXwxcq-tE3j-8d1WBxvEJvE,178
|
2
|
+
json_repair/json_repair.py,sha256=HTeKyorj6ennan9ToprV-Hub633U76qgvXExm0mclnE,23559
|
3
|
+
json_repair-0.17.4.dist-info/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
|
4
|
+
json_repair-0.17.4.dist-info/METADATA,sha256=JmwR4_i7AMj6E08Vy9I_y_zNm9Kk-2Avfz0or95M0Yc,7333
|
5
|
+
json_repair-0.17.4.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
6
|
+
json_repair-0.17.4.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
|
7
|
+
json_repair-0.17.4.dist-info/RECORD,,
|
@@ -1,7 +0,0 @@
|
|
1
|
-
json_repair/__init__.py,sha256=IIzSm1DsCRrr8seF3UeMZXwxcq-tE3j-8d1WBxvEJvE,178
|
2
|
-
json_repair/json_repair.py,sha256=NeAKskIWOewTpIDY3Z6wxYkDHjrNYHNuF4AFO-xBggI,23052
|
3
|
-
json_repair-0.17.2.dist-info/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
|
4
|
-
json_repair-0.17.2.dist-info/METADATA,sha256=5YoWE0n-iKY2nbZ0D9OQ8QwfA6zZIYVWUkLsYQmxrqo,7333
|
5
|
-
json_repair-0.17.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
6
|
-
json_repair-0.17.2.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
|
7
|
-
json_repair-0.17.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|