json-repair 0.29.6__py3-none-any.whl → 0.29.8__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.
@@ -291,6 +291,7 @@ class JSONParser:
291
291
  # * It iterated over the entire sequence
292
292
  # * If we are fixing missing quotes in an object, when it finds the special terminators
293
293
  char = self.get_char_at()
294
+ unmatched_delimiter = False
294
295
  while char and char != rstring_delimiter:
295
296
  if (
296
297
  missing_quotes
@@ -336,8 +337,8 @@ class JSONParser:
336
337
  if char and len(string_acc) > 0 and string_acc[-1] == "\\":
337
338
  # This is a special case, if people use real strings this might happen
338
339
  self.log("Found a stray escape sequence, normalizing it")
339
- string_acc = string_acc[:-1]
340
340
  if char in [rstring_delimiter, "t", "n", "r", "b", "\\"]:
341
+ string_acc = string_acc[:-1]
341
342
  escape_seqs = {"t": "\t", "n": "\n", "r": "\r", "b": "\b"}
342
343
  string_acc += escape_seqs.get(char, char) or char
343
344
  self.index += 1
@@ -377,6 +378,11 @@ class JSONParser:
377
378
  "In a string with missing quotes and object value context, I found a delimeter but it turns out it was the beginning on the next key. Stopping here.",
378
379
  )
379
380
  break
381
+ elif unmatched_delimiter:
382
+ unmatched_delimiter = False
383
+ string_acc += str(char)
384
+ self.index += 1
385
+ char = self.get_char_at()
380
386
  else:
381
387
  # Check if eventually there is a rstring delimiter, otherwise we bail
382
388
  i = 1
@@ -430,6 +436,7 @@ class JSONParser:
430
436
  self.log(
431
437
  "While parsing a string, we misplaced a quote that would have closed the string but has a different meaning here since this is the last element of the object, ignoring it",
432
438
  )
439
+ unmatched_delimiter = not unmatched_delimiter
433
440
  string_acc += str(char)
434
441
  self.index += 1
435
442
  char = self.get_char_at()
@@ -459,6 +466,7 @@ class JSONParser:
459
466
  self.log(
460
467
  "While parsing a string, we a misplaced quote that would have closed the string but has a different meaning here, ignoring it",
461
468
  )
469
+ unmatched_delimiter = not unmatched_delimiter
462
470
  string_acc += str(char)
463
471
  self.index += 1
464
472
  char = self.get_char_at()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: json_repair
3
- Version: 0.29.6
3
+ Version: 0.29.8
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=IIzSm1DsCRrr8seF3UeMZXwxcq-tE3j-8d1WBxvEJvE,178
2
2
  json_repair/__main__.py,sha256=EsJb-y89uZEvGQQg1GdIDWzfDwfOMvVekKEtdguQXCM,67
3
3
  json_repair/json_context.py,sha256=DdJu3DJR-ANvr8KrWfJqdtOE3uI6_B0VQidKvE3PjJA,1080
4
- json_repair/json_parser.py,sha256=6d8R2m29meyFz2_gxvF5olYs1VytAQTV-rDqIYzwjnE,26385
4
+ json_repair/json_parser.py,sha256=sAsGtUt-LUOXhSxViYDoCsQFINw29O1cmfSchTNfJPs,26793
5
5
  json_repair/json_repair.py,sha256=GTg3OAXRbAJAHWs8oiQDqUHh4h6qKDVvWPXcrqafzLY,6100
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.29.6.dist-info/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
9
- json_repair-0.29.6.dist-info/METADATA,sha256=Us1Nn8o5yaJHnssGY5t7X1yfii0NRCvlSjBH9TyANnw,10686
10
- json_repair-0.29.6.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
11
- json_repair-0.29.6.dist-info/entry_points.txt,sha256=SNfge3zPSP-ASqriYU9r3NAPaXdseYr7ciPMKdV2uSw,57
12
- json_repair-0.29.6.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
13
- json_repair-0.29.6.dist-info/RECORD,,
8
+ json_repair-0.29.8.dist-info/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
9
+ json_repair-0.29.8.dist-info/METADATA,sha256=yH1vmRAkZC8knJkMtcbVUSloE2sSMkOFFru-ZKgrhVk,10686
10
+ json_repair-0.29.8.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
11
+ json_repair-0.29.8.dist-info/entry_points.txt,sha256=SNfge3zPSP-ASqriYU9r3NAPaXdseYr7ciPMKdV2uSw,57
12
+ json_repair-0.29.8.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
13
+ json_repair-0.29.8.dist-info/RECORD,,