json-repair 0.5.1__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.
@@ -202,6 +202,7 @@ class JSONParser:
202
202
  # * It iterated over the entire sequence
203
203
  # * If we are fixing missing quotes in an object, when it finds the special terminators
204
204
  char = self.get_char_at()
205
+ fix_broken_markdown_link = False
205
206
  while char and char != string_terminator:
206
207
  if fixed_quotes:
207
208
  if self.context == "object_key" and (char == ":" or char.isspace()):
@@ -210,6 +211,17 @@ class JSONParser:
210
211
  break
211
212
  self.index += 1
212
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()
213
225
 
214
226
  if char and fixed_quotes and self.context == "object_key" and char.isspace():
215
227
  self.skip_whitespaces_at()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: json_repair
3
- Version: 0.5.1
3
+ Version: 0.6.0
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
@@ -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=TGG-59ZkjFdzAbN-7qzfsTRla-i3XcY8aTPC3XQYkPU,12703
3
- json_repair-0.5.1.dist-info/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
4
- json_repair-0.5.1.dist-info/METADATA,sha256=om2AIvr1N5hCh4YG2khSO3sZ34OtZIWeFC59tQ5MAIs,6011
5
- json_repair-0.5.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
6
- json_repair-0.5.1.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
7
- json_repair-0.5.1.dist-info/RECORD,,