json-repair 0.34.0__py3-none-any.whl → 0.35.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.
@@ -443,6 +443,38 @@ class JSONParser:
443
443
  string_acc += escape_seqs.get(char, char) or char
444
444
  self.index += 1
445
445
  char = self.get_char_at()
446
+ # If we are in object key context and we find a colon, it could be a missing right quote
447
+ if (
448
+ char == ":"
449
+ and not missing_quotes
450
+ and self.context.current == ContextValues.OBJECT_KEY
451
+ ):
452
+ # Ok now we need to check if this is followed by a value like "..."
453
+ i = self.skip_to_character(character=lstring_delimiter, idx=1)
454
+ next_c = self.get_char_at(i)
455
+ if next_c:
456
+ i += 1
457
+ # found the first delimiter
458
+ i = self.skip_to_character(character=rstring_delimiter, idx=i)
459
+ next_c = self.get_char_at(i)
460
+ if next_c:
461
+ # found a second delimiter
462
+ i += 1
463
+ # Skip spaces
464
+ i = self.skip_whitespaces_at(idx=i, move_main_index=False)
465
+ next_c = self.get_char_at(i)
466
+ if next_c and next_c in [",", "}"]:
467
+ # Ok then this is a missing right quote
468
+ self.log(
469
+ "While parsing a string missing the right delimiter in object key context, we found a :, stopping here",
470
+ )
471
+ break
472
+ else:
473
+ # The string ended without finding a lstring_delimiter, I will assume this is a missing right quote
474
+ self.log(
475
+ "While parsing a string missing the right delimiter in object key context, we found a :, stopping here",
476
+ )
477
+ break
446
478
  # ChatGPT sometimes forget to quote stuff in html tags or markdown, so we do this whole thing here
447
479
  if char == rstring_delimiter:
448
480
  # Special case here, in case of double quotes one after another
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: json_repair
3
- Version: 0.34.0
3
+ Version: 0.35.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=wGRN7RqY-LVcvaExZuwf4MdWCEK0rksrnQveS4nxuB0,33867
4
+ json_repair/json_parser.py,sha256=9ZHHQmfHPYQxSy93yjYPYtIHL415HiDo26hSuJCX4MA,35581
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=koZmdq2-Z5K7XF1bDqX6dEbNaVMJYcMTjq-aGe6NQvA,4526
8
- json_repair-0.34.0.dist-info/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
9
- json_repair-0.34.0.dist-info/METADATA,sha256=rzdTjUIhmniryioqyVocdm-Abd0btnHRM4sOZRDqKxE,11794
10
- json_repair-0.34.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
11
- json_repair-0.34.0.dist-info/entry_points.txt,sha256=SNfge3zPSP-ASqriYU9r3NAPaXdseYr7ciPMKdV2uSw,57
12
- json_repair-0.34.0.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
13
- json_repair-0.34.0.dist-info/RECORD,,
8
+ json_repair-0.35.0.dist-info/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
9
+ json_repair-0.35.0.dist-info/METADATA,sha256=hUDqZJmhcKN7_8UDQk6FfHjvBvPE-jbzkjiEBqP-26I,11794
10
+ json_repair-0.35.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
11
+ json_repair-0.35.0.dist-info/entry_points.txt,sha256=SNfge3zPSP-ASqriYU9r3NAPaXdseYr7ciPMKdV2uSw,57
12
+ json_repair-0.35.0.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
13
+ json_repair-0.35.0.dist-info/RECORD,,