json-repair 0.36.0__py3-none-any.whl → 0.37.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 +9 -4
- {json_repair-0.36.0.dist-info → json_repair-0.37.0.dist-info}/METADATA +1 -1
- {json_repair-0.36.0.dist-info → json_repair-0.37.0.dist-info}/RECORD +7 -7
- {json_repair-0.36.0.dist-info → json_repair-0.37.0.dist-info}/LICENSE +0 -0
- {json_repair-0.36.0.dist-info → json_repair-0.37.0.dist-info}/WHEEL +0 -0
- {json_repair-0.36.0.dist-info → json_repair-0.37.0.dist-info}/entry_points.txt +0 -0
- {json_repair-0.36.0.dist-info → json_repair-0.37.0.dist-info}/top_level.txt +0 -0
json_repair/json_parser.py
CHANGED
@@ -438,7 +438,7 @@ class JSONParser:
|
|
438
438
|
string_acc += char
|
439
439
|
self.index += 1
|
440
440
|
char = self.get_char_at()
|
441
|
-
if char and
|
441
|
+
if char and string_acc[-1] == "\\":
|
442
442
|
# This is a special case, if people use real strings this might happen
|
443
443
|
self.log("Found a stray escape sequence, normalizing it")
|
444
444
|
if char in [rstring_delimiter, "t", "n", "r", "b", "\\"]:
|
@@ -589,7 +589,7 @@ class JSONParser:
|
|
589
589
|
i += 1
|
590
590
|
next_c = self.get_char_at(i)
|
591
591
|
while next_c and next_c != ":":
|
592
|
-
if next_c
|
592
|
+
if next_c in [",", "]", "}"] or (
|
593
593
|
next_c == rstring_delimiter
|
594
594
|
and self.get_char_at(i - 1) != "\\"
|
595
595
|
):
|
@@ -646,10 +646,15 @@ class JSONParser:
|
|
646
646
|
self.log(
|
647
647
|
"While parsing a string, we missed the closing quote, ignoring",
|
648
648
|
)
|
649
|
+
string_acc = string_acc.rstrip()
|
649
650
|
else:
|
650
651
|
self.index += 1
|
651
652
|
|
652
|
-
|
653
|
+
if missing_quotes or (string_acc and string_acc[-1] == "\n"):
|
654
|
+
# Clean the whitespaces for some corner cases
|
655
|
+
string_acc = string_acc.rstrip()
|
656
|
+
|
657
|
+
return string_acc
|
653
658
|
|
654
659
|
def parse_number(self) -> Union[float, int, str, JSONReturnType]:
|
655
660
|
# <number> is a valid real number expressed in one of a number of given formats
|
@@ -661,7 +666,7 @@ class JSONParser:
|
|
661
666
|
number_str += char
|
662
667
|
self.index += 1
|
663
668
|
char = self.get_char_at()
|
664
|
-
if
|
669
|
+
if number_str and number_str[-1] in "-eE/,":
|
665
670
|
# The number ends with a non valid character for a number/currency, rolling back one
|
666
671
|
number_str = number_str[:-1]
|
667
672
|
self.index -= 1
|
@@ -1,13 +1,13 @@
|
|
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=XASjndsU8Q2NNXENoQJKCwZUxf0ezlsq538x7Y33T3A,35948
|
5
5
|
json_repair/json_repair.py,sha256=LINLSJBs3cJMfs1YRDaIpfWR5PJLs87Oe06G5yQjY18,9729
|
6
6
|
json_repair/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
7
|
json_repair/string_file_wrapper.py,sha256=koZmdq2-Z5K7XF1bDqX6dEbNaVMJYcMTjq-aGe6NQvA,4526
|
8
|
-
json_repair-0.
|
9
|
-
json_repair-0.
|
10
|
-
json_repair-0.
|
11
|
-
json_repair-0.
|
12
|
-
json_repair-0.
|
13
|
-
json_repair-0.
|
8
|
+
json_repair-0.37.0.dist-info/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
|
9
|
+
json_repair-0.37.0.dist-info/METADATA,sha256=GN2yJwIv5nrKgjKjocEdCbPioWmyghYqUPxj6ogvxfo,11794
|
10
|
+
json_repair-0.37.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
11
|
+
json_repair-0.37.0.dist-info/entry_points.txt,sha256=SNfge3zPSP-ASqriYU9r3NAPaXdseYr7ciPMKdV2uSw,57
|
12
|
+
json_repair-0.37.0.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
|
13
|
+
json_repair-0.37.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|