json-repair 0.32.0__py3-none-any.whl → 0.33.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.
@@ -508,9 +508,8 @@ class JSONParser:
508
508
  # But this might not be it! This could be just a missing comma
509
509
  # We found a delimiter and we need to check if this is a key
510
510
  # so find a rstring_delimiter and a colon after
511
- i += 1
512
511
  i = self.skip_to_character(
513
- character=rstring_delimiter, idx=i
512
+ character=rstring_delimiter, idx=i + 1
514
513
  )
515
514
  i += 1
516
515
  next_c = self.get_char_at(i)
@@ -531,6 +530,27 @@ class JSONParser:
531
530
  string_acc += str(char)
532
531
  self.index += 1
533
532
  char = self.get_char_at()
533
+ elif self.context.current == ContextValues.ARRAY:
534
+ # In array context this could be something like "lorem "ipsum" sic"
535
+ # So let's check if we find a rstring_delimiter forward otherwise end early
536
+ i = self.skip_to_character(rstring_delimiter, idx=i + 1)
537
+ next_c = self.get_char_at(i)
538
+ if next_c and next_c == rstring_delimiter:
539
+ # Ok now if I find a comma or a closing ], that can be have also an optional rstring_delimiter before them
540
+ # We can consider this a misplaced quote
541
+ i += 1
542
+ i = self.skip_whitespaces_at(
543
+ idx=i, move_main_index=False
544
+ )
545
+ next_c = self.get_char_at(i)
546
+ if next_c and next_c in [",", "]"]:
547
+ self.log(
548
+ "While parsing a string, we a misplaced quote that would have closed the string but has a different meaning here, ignoring it",
549
+ )
550
+ unmatched_delimiter = not unmatched_delimiter
551
+ string_acc += str(char)
552
+ self.index += 1
553
+ char = self.get_char_at()
534
554
 
535
555
  if (
536
556
  char
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: json_repair
3
- Version: 0.32.0
3
+ Version: 0.33.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=zOHJg9Uv-8-UkDV0curmcmqcH_hLOvyXVjitPCmE6Kw,30326
4
+ json_repair/json_parser.py,sha256=qLMNN6xJm-8CM4446WizbENCBnFKzEoSM4VLZXTGXaQ,31831
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.32.0.dist-info/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
9
- json_repair-0.32.0.dist-info/METADATA,sha256=Sbk5aG5bviThWyIXG4inuXPoJ9b0XNrAR1Hp-RVxdvY,11794
10
- json_repair-0.32.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
11
- json_repair-0.32.0.dist-info/entry_points.txt,sha256=SNfge3zPSP-ASqriYU9r3NAPaXdseYr7ciPMKdV2uSw,57
12
- json_repair-0.32.0.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
13
- json_repair-0.32.0.dist-info/RECORD,,
8
+ json_repair-0.33.0.dist-info/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
9
+ json_repair-0.33.0.dist-info/METADATA,sha256=-cTTyNlIlv3xouXyqxRuHDhSXT-2_QuB5AdeKpDbxs4,11794
10
+ json_repair-0.33.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
11
+ json_repair-0.33.0.dist-info/entry_points.txt,sha256=SNfge3zPSP-ASqriYU9r3NAPaXdseYr7ciPMKdV2uSw,57
12
+ json_repair-0.33.0.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
13
+ json_repair-0.33.0.dist-info/RECORD,,