json-repair 0.5.0__py3-none-any.whl → 0.6.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 +17 -0
- {json_repair-0.5.0.dist-info → json_repair-0.6.0.dist-info}/METADATA +1 -1
- json_repair-0.6.0.dist-info/RECORD +7 -0
- json_repair-0.5.0.dist-info/RECORD +0 -7
- {json_repair-0.5.0.dist-info → json_repair-0.6.0.dist-info}/LICENSE +0 -0
- {json_repair-0.5.0.dist-info → json_repair-0.6.0.dist-info}/WHEEL +0 -0
- {json_repair-0.5.0.dist-info → json_repair-0.6.0.dist-info}/top_level.txt +0 -0
json_repair/json_repair.py
CHANGED
@@ -111,6 +111,11 @@ class JSONParser:
|
|
111
111
|
use_single_quotes=(self.json_str[self.index] == "'")
|
112
112
|
)
|
113
113
|
|
114
|
+
# This can happen sometimes like { "": "value" }
|
115
|
+
if key == "" and self.get_char_at() == ":":
|
116
|
+
key = "empty_placeholder"
|
117
|
+
break
|
118
|
+
|
114
119
|
# We reached the end here
|
115
120
|
if key == "}":
|
116
121
|
continue
|
@@ -197,6 +202,7 @@ class JSONParser:
|
|
197
202
|
# * It iterated over the entire sequence
|
198
203
|
# * If we are fixing missing quotes in an object, when it finds the special terminators
|
199
204
|
char = self.get_char_at()
|
205
|
+
fix_broken_markdown_link = False
|
200
206
|
while char and char != string_terminator:
|
201
207
|
if fixed_quotes:
|
202
208
|
if self.context == "object_key" and (char == ":" or char.isspace()):
|
@@ -205,6 +211,17 @@ class JSONParser:
|
|
205
211
|
break
|
206
212
|
self.index += 1
|
207
213
|
char = self.get_char_at()
|
214
|
+
# ChatGPT sometimes forget to quote links in markdown like: { "content": "[LINK]("https://google.com")" }
|
215
|
+
if char == string_terminator and (
|
216
|
+
fix_broken_markdown_link
|
217
|
+
or (
|
218
|
+
self.index - 2 > 0
|
219
|
+
and self.json_str[self.index - 2 : self.index] == "]("
|
220
|
+
)
|
221
|
+
):
|
222
|
+
fix_broken_markdown_link = not fix_broken_markdown_link
|
223
|
+
self.index += 1
|
224
|
+
char = self.get_char_at()
|
208
225
|
|
209
226
|
if char and fixed_quotes and self.context == "object_key" and char.isspace():
|
210
227
|
self.skip_whitespaces_at()
|
@@ -0,0 +1,7 @@
|
|
1
|
+
json_repair/__init__.py,sha256=p9mZnte8Bg18NcxqgJ7vopH2gQv_XbZ0dRnk686QuRE,92
|
2
|
+
json_repair/json_repair.py,sha256=LsyNEo2mDgEcwyJo8A0WeH8ftl3GGxZ5rCcltXcINwI,13264
|
3
|
+
json_repair-0.6.0.dist-info/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
|
4
|
+
json_repair-0.6.0.dist-info/METADATA,sha256=t9EOoV2aaymk5054TKJK5xKLUiCax0DmCDhwpLQ31Oo,6011
|
5
|
+
json_repair-0.6.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
6
|
+
json_repair-0.6.0.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
|
7
|
+
json_repair-0.6.0.dist-info/RECORD,,
|
@@ -1,7 +0,0 @@
|
|
1
|
-
json_repair/__init__.py,sha256=p9mZnte8Bg18NcxqgJ7vopH2gQv_XbZ0dRnk686QuRE,92
|
2
|
-
json_repair/json_repair.py,sha256=Hdevgq1_s8JaHCALBd7gTxp8_DexKezz8g6Cm0LcJTc,12505
|
3
|
-
json_repair-0.5.0.dist-info/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
|
4
|
-
json_repair-0.5.0.dist-info/METADATA,sha256=6_UiFGc3X93VQ8tFU1y02b16fbMyRybrQu1B7wwBmL8,6011
|
5
|
-
json_repair-0.5.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
6
|
-
json_repair-0.5.0.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
|
7
|
-
json_repair-0.5.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|