json-repair 0.29.1__py3-none-any.whl → 0.29.2__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- json_repair/json_repair.py +30 -29
- {json_repair-0.29.1.dist-info → json_repair-0.29.2.dist-info}/METADATA +1 -1
- json_repair-0.29.2.dist-info/RECORD +10 -0
- json_repair-0.29.1.dist-info/RECORD +0 -10
- {json_repair-0.29.1.dist-info → json_repair-0.29.2.dist-info}/LICENSE +0 -0
- {json_repair-0.29.1.dist-info → json_repair-0.29.2.dist-info}/WHEEL +0 -0
- {json_repair-0.29.1.dist-info → json_repair-0.29.2.dist-info}/entry_points.txt +0 -0
- {json_repair-0.29.1.dist-info → json_repair-0.29.2.dist-info}/top_level.txt +0 -0
json_repair/json_repair.py
CHANGED
@@ -384,38 +384,39 @@ class JSONParser:
|
|
384
384
|
# * If we are fixing missing quotes in an object, when it finds the special terminators
|
385
385
|
char = self.get_char_at()
|
386
386
|
while char and char != rstring_delimiter:
|
387
|
-
if
|
388
|
-
|
389
|
-
|
390
|
-
)
|
387
|
+
if (
|
388
|
+
missing_quotes
|
389
|
+
and self.get_context() == "object_key"
|
390
|
+
and (char == ":" or char.isspace())
|
391
|
+
):
|
392
|
+
self.log(
|
393
|
+
"While parsing a string missing the left delimiter in object key context, we found a :, stopping here",
|
394
|
+
"info",
|
395
|
+
)
|
396
|
+
break
|
397
|
+
if self.get_context() == "object_value" and char in [",", "}"]:
|
398
|
+
rstring_delimiter_missing = True
|
399
|
+
# check if this is a case in which the closing comma is NOT missing instead
|
400
|
+
i = 1
|
401
|
+
next_c = self.get_char_at(i)
|
402
|
+
while next_c and next_c != rstring_delimiter:
|
403
|
+
i += 1
|
404
|
+
next_c = self.get_char_at(i)
|
405
|
+
if next_c:
|
406
|
+
i += 1
|
407
|
+
next_c = self.get_char_at(i)
|
408
|
+
# found a delimiter, now we need to check that is followed strictly by a comma or brace
|
409
|
+
while next_c and next_c.isspace():
|
410
|
+
i += 1
|
411
|
+
next_c = self.get_char_at(i)
|
412
|
+
if next_c and next_c in [",", "}"]:
|
413
|
+
rstring_delimiter_missing = False
|
414
|
+
if rstring_delimiter_missing:
|
391
415
|
self.log(
|
392
|
-
"While parsing a string missing the left delimiter in object
|
416
|
+
"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",
|
393
417
|
"info",
|
394
418
|
)
|
395
419
|
break
|
396
|
-
elif self.get_context() == "object_value" and char in [",", "}"]:
|
397
|
-
rstring_delimiter_missing = True
|
398
|
-
# check if this is a case in which the closing comma is NOT missing instead
|
399
|
-
i = 1
|
400
|
-
next_c = self.get_char_at(i)
|
401
|
-
while next_c and next_c != rstring_delimiter:
|
402
|
-
i += 1
|
403
|
-
next_c = self.get_char_at(i)
|
404
|
-
if next_c:
|
405
|
-
i += 1
|
406
|
-
next_c = self.get_char_at(i)
|
407
|
-
# found a delimiter, now we need to check that is followed strictly by a comma or brace
|
408
|
-
while next_c and next_c.isspace():
|
409
|
-
i += 1
|
410
|
-
next_c = self.get_char_at(i)
|
411
|
-
if next_c and next_c in [",", "}"]:
|
412
|
-
rstring_delimiter_missing = False
|
413
|
-
if rstring_delimiter_missing:
|
414
|
-
self.log(
|
415
|
-
"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",
|
416
|
-
"info",
|
417
|
-
)
|
418
|
-
break
|
419
420
|
string_acc += char
|
420
421
|
self.index += 1
|
421
422
|
char = self.get_char_at()
|
@@ -507,7 +508,7 @@ class JSONParser:
|
|
507
508
|
if next_c == "}":
|
508
509
|
# OK this is valid then
|
509
510
|
self.log(
|
510
|
-
"While parsing a string, we a
|
511
|
+
"While parsing a string, we misplaced a quote that would have closed the string but has a different meaning here since this is the last element of the object, ignoring it",
|
511
512
|
"info",
|
512
513
|
)
|
513
514
|
string_acc += str(char)
|
@@ -0,0 +1,10 @@
|
|
1
|
+
json_repair/__init__.py,sha256=IIzSm1DsCRrr8seF3UeMZXwxcq-tE3j-8d1WBxvEJvE,178
|
2
|
+
json_repair/__main__.py,sha256=EsJb-y89uZEvGQQg1GdIDWzfDwfOMvVekKEtdguQXCM,67
|
3
|
+
json_repair/json_repair.py,sha256=anGQI5RxauBnZUO9QKoPU7JgN_sUaIddyiR4ecpMmm8,34060
|
4
|
+
json_repair/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
+
json_repair-0.29.2.dist-info/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
|
6
|
+
json_repair-0.29.2.dist-info/METADATA,sha256=Jtwl047L79Xj0CmA363Xc2EemzttgMWqYW0abi4a7fA,9787
|
7
|
+
json_repair-0.29.2.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
|
8
|
+
json_repair-0.29.2.dist-info/entry_points.txt,sha256=SNfge3zPSP-ASqriYU9r3NAPaXdseYr7ciPMKdV2uSw,57
|
9
|
+
json_repair-0.29.2.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
|
10
|
+
json_repair-0.29.2.dist-info/RECORD,,
|
@@ -1,10 +0,0 @@
|
|
1
|
-
json_repair/__init__.py,sha256=IIzSm1DsCRrr8seF3UeMZXwxcq-tE3j-8d1WBxvEJvE,178
|
2
|
-
json_repair/__main__.py,sha256=EsJb-y89uZEvGQQg1GdIDWzfDwfOMvVekKEtdguQXCM,67
|
3
|
-
json_repair/json_repair.py,sha256=amzSIOX_wR22QCheozEzsPLA09RRc8AybBUaiIIJagI,34164
|
4
|
-
json_repair/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
-
json_repair-0.29.1.dist-info/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
|
6
|
-
json_repair-0.29.1.dist-info/METADATA,sha256=q2kI12fNuayrEkqqDtVWKmagimcSgAKPHdanuQwMAtI,9787
|
7
|
-
json_repair-0.29.1.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
|
8
|
-
json_repair-0.29.1.dist-info/entry_points.txt,sha256=SNfge3zPSP-ASqriYU9r3NAPaXdseYr7ciPMKdV2uSw,57
|
9
|
-
json_repair-0.29.1.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
|
10
|
-
json_repair-0.29.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|