json-repair 0.45.1__py3-none-any.whl → 0.46.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.
@@ -231,7 +231,20 @@ class JSONParser:
231
231
  char = self.get_char_at()
232
232
  while char and char not in ["]", "}"]:
233
233
  self.skip_whitespaces_at()
234
- value = self.parse_json()
234
+ value: JSONReturnType = ""
235
+ if char in self.STRING_DELIMITERS:
236
+ # Sometimes it can happen that LLMs forget to start an object and then you think it's a string in an array
237
+ # So we are going to check if this string is followed by a : or not
238
+ # And either parse the string or parse the object
239
+ i = 1
240
+ i = self.skip_to_character(char, i)
241
+ i = self.skip_whitespaces_at(idx=i + 1, move_main_index=False)
242
+ if self.get_char_at(i) == ":":
243
+ value = self.parse_object()
244
+ else:
245
+ value = self.parse_string()
246
+ else:
247
+ value = self.parse_json()
235
248
 
236
249
  # It is possible that parse_json() returns nothing valid, so we increase by 1
237
250
  if value == "":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: json_repair
3
- Version: 0.45.1
3
+ Version: 0.46.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
@@ -1,14 +1,14 @@
1
1
  json_repair/__init__.py,sha256=c4L2kZrHvWEKfj_ODU2naliNuvU6FlFVxtF0hbLe6s8,178
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=r0v4BkBwrNMoKKIjDFhW6g6arVLB_Wq0zzo1ykYNMxk,39624
4
+ json_repair/json_parser.py,sha256=y-JZiKUjC5IdB2u4OR2SyDQcOWO2EIJz1iRKHlLRXYo,40323
5
5
  json_repair/json_repair.py,sha256=9wxf0vVNfr_RNQI1rbVPvxQ9feEwwvgnvkiYXwGEBX8,11292
6
6
  json_repair/object_comparer.py,sha256=ZjxrzepSNGrhiwzid2Dm657x1Aj-E1-h37bDygK8ByE,1261
7
7
  json_repair/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  json_repair/string_file_wrapper.py,sha256=uwW4B1s9Cf-iF3ANsCz-RPu2ddCqDETrt8bdojh8ufA,4485
9
- json_repair-0.45.1.dist-info/licenses/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
10
- json_repair-0.45.1.dist-info/METADATA,sha256=a0Rw8hnNPOoWZwEQC_r3fuWg2SXsZ5YocximamSlRjE,12159
11
- json_repair-0.45.1.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
12
- json_repair-0.45.1.dist-info/entry_points.txt,sha256=SNfge3zPSP-ASqriYU9r3NAPaXdseYr7ciPMKdV2uSw,57
13
- json_repair-0.45.1.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
14
- json_repair-0.45.1.dist-info/RECORD,,
9
+ json_repair-0.46.0.dist-info/licenses/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
10
+ json_repair-0.46.0.dist-info/METADATA,sha256=xp8t58AzqrRymn8hBe0KSjcM92Auek4vj56dzCdDSM8,12159
11
+ json_repair-0.46.0.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
12
+ json_repair-0.46.0.dist-info/entry_points.txt,sha256=SNfge3zPSP-ASqriYU9r3NAPaXdseYr7ciPMKdV2uSw,57
13
+ json_repair-0.46.0.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
14
+ json_repair-0.46.0.dist-info/RECORD,,