json-repair 0.47.2__py3-none-any.whl → 0.47.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_parser.py +9 -3
- {json_repair-0.47.2.dist-info → json_repair-0.47.4.dist-info}/METADATA +2 -1
- {json_repair-0.47.2.dist-info → json_repair-0.47.4.dist-info}/RECORD +7 -7
- {json_repair-0.47.2.dist-info → json_repair-0.47.4.dist-info}/WHEEL +0 -0
- {json_repair-0.47.2.dist-info → json_repair-0.47.4.dist-info}/entry_points.txt +0 -0
- {json_repair-0.47.2.dist-info → json_repair-0.47.4.dist-info}/licenses/LICENSE +0 -0
- {json_repair-0.47.2.dist-info → json_repair-0.47.4.dist-info}/top_level.txt +0 -0
json_repair/json_parser.py
CHANGED
@@ -311,10 +311,12 @@ class JSONParser:
|
|
311
311
|
# There is sometimes a weird case of doubled quotes, we manage this also later in the while loop
|
312
312
|
if self.get_char_at() in self.STRING_DELIMITERS and self.get_char_at() == lstring_delimiter:
|
313
313
|
# If it's an empty key, this was easy
|
314
|
-
if self.context.current == ContextValues.OBJECT_KEY and self.get_char_at(1) == ":"
|
314
|
+
if (self.context.current == ContextValues.OBJECT_KEY and self.get_char_at(1) == ":") or (
|
315
|
+
self.context.current == ContextValues.OBJECT_VALUE and self.get_char_at(1) in [",", "}"]
|
316
|
+
):
|
315
317
|
self.index += 1
|
316
318
|
return ""
|
317
|
-
|
319
|
+
elif self.get_char_at(1) == lstring_delimiter:
|
318
320
|
# There's something fishy about this, we found doubled quotes and then again quotes
|
319
321
|
self.log(
|
320
322
|
"While parsing a string, we found a doubled quote and then a quote again, ignoring it",
|
@@ -373,10 +375,14 @@ class JSONParser:
|
|
373
375
|
",",
|
374
376
|
"}",
|
375
377
|
]
|
376
|
-
and string_acc[-1] != rstring_delimiter
|
378
|
+
and (not string_acc or string_acc[-1] != rstring_delimiter)
|
377
379
|
):
|
378
380
|
rstring_delimiter_missing = True
|
379
381
|
# check if this is a case in which the closing comma is NOT missing instead
|
382
|
+
self.skip_whitespaces_at()
|
383
|
+
if self.get_char_at(1) == "\\":
|
384
|
+
# Ok this is a quoted string, skip
|
385
|
+
rstring_delimiter_missing = False
|
380
386
|
i = self.skip_to_character(character=rstring_delimiter, idx=1)
|
381
387
|
next_c = self.get_char_at(i)
|
382
388
|
if next_c:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: json_repair
|
3
|
-
Version: 0.47.
|
3
|
+
Version: 0.47.4
|
4
4
|
Summary: A package to repair broken json strings
|
5
5
|
Author-email: Stefano Baccianella <4247706+mangiucugna@users.noreply.github.com>
|
6
6
|
License: MIT License
|
@@ -294,6 +294,7 @@ You will need owner access to this repository
|
|
294
294
|
- Go: https://github.com/RealAlexandreAI/json-repair
|
295
295
|
- Ruby: https://github.com/sashazykov/json-repair-rb
|
296
296
|
- Rust: https://github.com/oramasearch/llm_json
|
297
|
+
- R: https://github.com/cgxjdzz/jsonRepair
|
297
298
|
---
|
298
299
|
## Star History
|
299
300
|
|
@@ -1,14 +1,14 @@
|
|
1
1
|
json_repair/__init__.py,sha256=6FDD6dEVM5Pb5o4Zodgw4ex30Hzy-YvNRy0vts9SQ4I,118
|
2
2
|
json_repair/__main__.py,sha256=EsJb-y89uZEvGQQg1GdIDWzfDwfOMvVekKEtdguQXCM,67
|
3
3
|
json_repair/json_context.py,sha256=WsMOjqpGSr6aaDONcrk8UFtTurzWon2Qq9AoBBYseoI,934
|
4
|
-
json_repair/json_parser.py,sha256=
|
4
|
+
json_repair/json_parser.py,sha256=412X7sLnSjN3Rk8l0kSSeNbrDn9wrEgHT31Non-qYzU,40567
|
5
5
|
json_repair/json_repair.py,sha256=0qL2LuzlNJa3VnEqYNaJyZNAL2w18oAt2YvA-TlMxmY,11211
|
6
6
|
json_repair/object_comparer.py,sha256=LlIF0MisRglzC-CiG5AxAEDCBWBHeJd-6uXYx0uRmCk,1175
|
7
7
|
json_repair/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
8
|
json_repair/string_file_wrapper.py,sha256=tGkWBEUPE-CZPf4uSM5NE9oSDTpskX0myJiXsl-gbds,4333
|
9
|
-
json_repair-0.47.
|
10
|
-
json_repair-0.47.
|
11
|
-
json_repair-0.47.
|
12
|
-
json_repair-0.47.
|
13
|
-
json_repair-0.47.
|
14
|
-
json_repair-0.47.
|
9
|
+
json_repair-0.47.4.dist-info/licenses/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
|
10
|
+
json_repair-0.47.4.dist-info/METADATA,sha256=FU5u40Z4wL4VhYHE72CyO3CstJkv1TV1PT-wn_Oracs,12411
|
11
|
+
json_repair-0.47.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
12
|
+
json_repair-0.47.4.dist-info/entry_points.txt,sha256=SNfge3zPSP-ASqriYU9r3NAPaXdseYr7ciPMKdV2uSw,57
|
13
|
+
json_repair-0.47.4.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
|
14
|
+
json_repair-0.47.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|