json-repair 0.30.2__py3-none-any.whl → 0.31.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.
@@ -322,11 +322,24 @@ class JSONParser:
322
322
  else:
323
323
  # OK but this could still be some garbage at the end of the string
324
324
  # So we need to check if we find a new lstring_delimiter afterwards
325
- # If we do, this is a missing delimiter
325
+ # If we do, maybe this is a missing delimiter
326
326
  i = self.skip_to_character(character=lstring_delimiter, idx=i)
327
+ if doubled_quotes:
328
+ i = self.skip_to_character(
329
+ character=lstring_delimiter, idx=i
330
+ )
327
331
  next_c = self.get_char_at(i)
328
332
  if not next_c:
329
333
  rstring_delimiter_missing = False
334
+ else:
335
+ # But again, this could just be something a bit stupid like "lorem, "ipsum" sic"
336
+ # Check if we find a : afterwards (skipping space)
337
+ i = self.skip_whitespaces_at(
338
+ idx=i + 1, move_main_index=False
339
+ )
340
+ next_c = self.get_char_at(i)
341
+ if next_c and next_c != ":":
342
+ rstring_delimiter_missing = False
330
343
  else:
331
344
  # There could be a case in which even the next key:value is missing delimeters
332
345
  # because it might be a systemic issue with the output
@@ -362,6 +375,13 @@ class JSONParser:
362
375
  "While parsing a string missing the left delimiter in object value context, we found a , or } and we couldn't determine that a right delimiter was present. Stopping here",
363
376
  )
364
377
  break
378
+ if char == "]" and ContextValues.ARRAY in self.context.context:
379
+ # We found the end of an array and we are in array context
380
+ # So let's check if we find a rstring_delimiter forward otherwise end early
381
+ i = self.skip_to_character(rstring_delimiter)
382
+ if not self.get_char_at(i):
383
+ # No delimiter found
384
+ break
365
385
  string_acc += char
366
386
  self.index += 1
367
387
  char = self.get_char_at()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: json_repair
3
- Version: 0.30.2
3
+ Version: 0.31.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,13 +1,13 @@
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=mm6dOyrPJ1sDskTORZSXCW7W9-5veMlUKqXQ3Hw3EG4,971
4
- json_repair/json_parser.py,sha256=7qVtBWheWPrLDJxej4lwdgi0zRH_TBReOXGsy18ZfZs,28698
4
+ json_repair/json_parser.py,sha256=8q81FKLqHlsL8BsLCn5gAYvHnHLgZw3HXc8DyHMYYZc,29867
5
5
  json_repair/json_repair.py,sha256=LINLSJBs3cJMfs1YRDaIpfWR5PJLs87Oe06G5yQjY18,9729
6
6
  json_repair/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  json_repair/string_file_wrapper.py,sha256=EHLhNBWoyUitzT08thytYJiNZh_klEFwfT8zutPSdb4,3905
8
- json_repair-0.30.2.dist-info/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
9
- json_repair-0.30.2.dist-info/METADATA,sha256=SLQn7rdr1YWIy49JdefVozK6yiz2Y61mh0UDde8omSI,11794
10
- json_repair-0.30.2.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
11
- json_repair-0.30.2.dist-info/entry_points.txt,sha256=SNfge3zPSP-ASqriYU9r3NAPaXdseYr7ciPMKdV2uSw,57
12
- json_repair-0.30.2.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
13
- json_repair-0.30.2.dist-info/RECORD,,
8
+ json_repair-0.31.0.dist-info/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
9
+ json_repair-0.31.0.dist-info/METADATA,sha256=_pBYrJ8pfhe0NNivTg1oUVyt0t9P3NCqFcV8n1cGgJg,11794
10
+ json_repair-0.31.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
11
+ json_repair-0.31.0.dist-info/entry_points.txt,sha256=SNfge3zPSP-ASqriYU9r3NAPaXdseYr7ciPMKdV2uSw,57
12
+ json_repair-0.31.0.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
13
+ json_repair-0.31.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.5.0)
2
+ Generator: setuptools (75.6.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5