json-repair 0.24.0__py3-none-any.whl → 0.25.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_repair.py +35 -0
- {json_repair-0.24.0.dist-info → json_repair-0.25.0.dist-info}/METADATA +1 -1
- json_repair-0.25.0.dist-info/RECORD +7 -0
- json_repair-0.24.0.dist-info/RECORD +0 -7
- {json_repair-0.24.0.dist-info → json_repair-0.25.0.dist-info}/LICENSE +0 -0
- {json_repair-0.24.0.dist-info → json_repair-0.25.0.dist-info}/WHEEL +0 -0
- {json_repair-0.24.0.dist-info → json_repair-0.25.0.dist-info}/top_level.txt +0 -0
json_repair/json_repair.py
CHANGED
@@ -370,6 +370,10 @@ class JSONParser:
|
|
370
370
|
if self.get_context() == "object_key" and (
|
371
371
|
char == ":" or char.isspace()
|
372
372
|
):
|
373
|
+
self.log(
|
374
|
+
"While parsing a string missing the left delimiter in object key context, we found a :, stopping here",
|
375
|
+
"info",
|
376
|
+
)
|
373
377
|
break
|
374
378
|
elif self.get_context() == "object_value" and char in [",", "}"]:
|
375
379
|
rstring_delimiter_missing = True
|
@@ -389,6 +393,10 @@ class JSONParser:
|
|
389
393
|
if next_c and next_c in [",", "}"]:
|
390
394
|
rstring_delimiter_missing = False
|
391
395
|
if rstring_delimiter_missing:
|
396
|
+
self.log(
|
397
|
+
"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",
|
398
|
+
"info",
|
399
|
+
)
|
392
400
|
break
|
393
401
|
string_acc += char
|
394
402
|
self.index += 1
|
@@ -410,6 +418,33 @@ class JSONParser:
|
|
410
418
|
"While parsing a string, we found a doubled quote, ignoring it",
|
411
419
|
"info",
|
412
420
|
)
|
421
|
+
elif missing_quotes and self.get_context() == "object_value":
|
422
|
+
# In case of missing starting quote I need to check if the delimeter is the end or the beginning of a key
|
423
|
+
i = 1
|
424
|
+
next_c = self.get_char_at(i)
|
425
|
+
while next_c and next_c not in [
|
426
|
+
rstring_delimiter,
|
427
|
+
lstring_delimiter,
|
428
|
+
]:
|
429
|
+
i += 1
|
430
|
+
next_c = self.get_char_at(i)
|
431
|
+
if next_c:
|
432
|
+
# We found a quote, now let's make sure there's a ":" following
|
433
|
+
i += 1
|
434
|
+
next_c = self.get_char_at(i)
|
435
|
+
# found a delimiter, now we need to check that is followed strictly by a comma or brace
|
436
|
+
while next_c and next_c.isspace():
|
437
|
+
i += 1
|
438
|
+
next_c = self.get_char_at(i)
|
439
|
+
if next_c and next_c == ":":
|
440
|
+
# Reset the cursor
|
441
|
+
self.index -= 1
|
442
|
+
char = self.get_char_at()
|
443
|
+
self.log(
|
444
|
+
"In a string with missing quotes and object value context, I found a delimeter but it turns out it was the beginning on the next key. Stopping here.",
|
445
|
+
"info",
|
446
|
+
)
|
447
|
+
break
|
413
448
|
else:
|
414
449
|
# Check if eventually there is a rstring delimiter, otherwise we bail
|
415
450
|
i = 1
|
@@ -0,0 +1,7 @@
|
|
1
|
+
json_repair/__init__.py,sha256=IIzSm1DsCRrr8seF3UeMZXwxcq-tE3j-8d1WBxvEJvE,178
|
2
|
+
json_repair/json_repair.py,sha256=RyxtqoMopJvEwVestHDP_D6FnVkSt3bmmr1liYOQwHE,30976
|
3
|
+
json_repair-0.25.0.dist-info/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
|
4
|
+
json_repair-0.25.0.dist-info/METADATA,sha256=K6rBtBRbVuRQICWknDvDm3OnNq_bGrwT7K6U99PPYmg,7596
|
5
|
+
json_repair-0.25.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
6
|
+
json_repair-0.25.0.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
|
7
|
+
json_repair-0.25.0.dist-info/RECORD,,
|
@@ -1,7 +0,0 @@
|
|
1
|
-
json_repair/__init__.py,sha256=IIzSm1DsCRrr8seF3UeMZXwxcq-tE3j-8d1WBxvEJvE,178
|
2
|
-
json_repair/json_repair.py,sha256=jM509L0rg8AiWksnYdOqueopP8fmh0MJxpxx7LvaoiM,28954
|
3
|
-
json_repair-0.24.0.dist-info/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
|
4
|
-
json_repair-0.24.0.dist-info/METADATA,sha256=kSxFAdkH_qxJMX85DKW605BOZrbh8VCWzsAvP_X80cM,7596
|
5
|
-
json_repair-0.24.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
6
|
-
json_repair-0.24.0.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
|
7
|
-
json_repair-0.24.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|