json-repair 0.52.1__py3-none-any.whl → 0.52.3__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.
@@ -81,6 +81,7 @@ class JSONParser:
81
81
  )
82
82
  json = [json]
83
83
  while self.index < len(self.json_str):
84
+ self.context.reset()
84
85
  j = self.parse_json()
85
86
  if j != "":
86
87
  if ObjectComparer.is_same_object(json[-1], j):
@@ -206,6 +206,17 @@ def parse_string(self: "JSONParser") -> JSONReturnType:
206
206
  # Check if the object is really over, to avoid doubling the closing brace
207
207
  i = self.skip_whitespaces_at(idx=1, move_main_index=False)
208
208
  next_c = self.get_char_at(i)
209
+ if next_c and next_c == "`":
210
+ # This could be a special case in which the LLM added code fences after the object
211
+ # So we need to check if there are another two ` after this one`
212
+ next_c = self.get_char_at(i + 1)
213
+ if next_c and next_c == "`":
214
+ next_c = self.get_char_at(i + 2)
215
+ if next_c and next_c == "`":
216
+ self.log(
217
+ "While parsing a string in object value context, we found a } that closes the object before code fences, stopping here",
218
+ )
219
+ break
209
220
  if not next_c:
210
221
  self.log(
211
222
  "While parsing a string in object value context, we found a } that closes the object, stopping here",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: json_repair
3
- Version: 0.52.1
3
+ Version: 0.52.3
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-Expression: MIT
@@ -2,7 +2,7 @@ json_repair/__init__.py,sha256=JdJIZNCKV3MfIviryqK8NH8yGssCta2-192CekcwH-o,174
2
2
  json_repair/__main__.py,sha256=EsJb-y89uZEvGQQg1GdIDWzfDwfOMvVekKEtdguQXCM,67
3
3
  json_repair/constants.py,sha256=cv2gvyosuq0me0600WyTysM9avrtfXPuXYR26tawcuo,158
4
4
  json_repair/json_context.py,sha256=WsMOjqpGSr6aaDONcrk8UFtTurzWon2Qq9AoBBYseoI,934
5
- json_repair/json_parser.py,sha256=E5_xTtkLy4cNo2bgsBuGkQkpaL7NqJgODgWU_9rCEmE,7637
5
+ json_repair/json_parser.py,sha256=S4Ogczq42CiYbuF06EsDGkVJx05ePgTvrKIUQsZrBzM,7674
6
6
  json_repair/json_repair.py,sha256=sDhXzDZxu0QmaFzICPTtf_q7yOY1A1Lf_iQG6Potsco,11572
7
7
  json_repair/object_comparer.py,sha256=XKV3MRab8H7_v4sm-wpEa5le0XX9OeycWo5S-MFm-GI,1716
8
8
  json_repair/parse_array.py,sha256=-rh65JcfT-FtXiR6s8RYlMfI-6LzVr08ytlDh6Z2CFE,2181
@@ -10,12 +10,12 @@ json_repair/parse_boolean_or_null.py,sha256=WMSkvvxsp4wvauBcDqtt9WnLMD5SMoxeRfZF
10
10
  json_repair/parse_comment.py,sha256=JHtQ_QlxOvPNnMh7lhUaoTjFGelqjhTNq7qn9xUE7SU,2648
11
11
  json_repair/parse_number.py,sha256=33zAtkbuVzi9Lqjxu7cXn9WlVzd3WjRx9Ln_LFzVL4o,1259
12
12
  json_repair/parse_object.py,sha256=xMpO64sYW0JmUtW75BTD0EdPQjY7PYVgu4tHVXrWB6s,5582
13
- json_repair/parse_string.py,sha256=1vT1mRGaNPU0wvwv0D3uBlA-Rtv1DI8r5rld-xLUx74,24950
13
+ json_repair/parse_string.py,sha256=dx4ahhp-BU7HjTxoJ5eH_wh9SlMQgatZ4AqIq33sPKA,25606
14
14
  json_repair/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  json_repair/string_file_wrapper.py,sha256=tGkWBEUPE-CZPf4uSM5NE9oSDTpskX0myJiXsl-gbds,4333
16
- json_repair-0.52.1.dist-info/licenses/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
17
- json_repair-0.52.1.dist-info/METADATA,sha256=1W1OMlwVKBq05NIbazEZMnXQJXsMbosqmaYotZBYnGM,11027
18
- json_repair-0.52.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
19
- json_repair-0.52.1.dist-info/entry_points.txt,sha256=SNfge3zPSP-ASqriYU9r3NAPaXdseYr7ciPMKdV2uSw,57
20
- json_repair-0.52.1.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
21
- json_repair-0.52.1.dist-info/RECORD,,
16
+ json_repair-0.52.3.dist-info/licenses/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
17
+ json_repair-0.52.3.dist-info/METADATA,sha256=dV2kve2-BvHu3kSGSj9TeN5588xeTiK7iEcYwuJGuk4,11027
18
+ json_repair-0.52.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
19
+ json_repair-0.52.3.dist-info/entry_points.txt,sha256=SNfge3zPSP-ASqriYU9r3NAPaXdseYr7ciPMKdV2uSw,57
20
+ json_repair-0.52.3.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
21
+ json_repair-0.52.3.dist-info/RECORD,,