json-repair 0.16.0__py3-none-any.whl → 0.16.1__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.
@@ -302,7 +302,8 @@ class JSONParser:
302
302
  while next_c and next_c != rstring_delimiter:
303
303
  # If we are in an object context, let's check for the right delimiters
304
304
  if (
305
- ("object_key" in self.context and next_c == ":")
305
+ next_c == lstring_delimiter
306
+ or ("object_key" in self.context and next_c == ":")
306
307
  or ("object_value" in self.context and next_c in ["}", ","])
307
308
  or ("array" in self.context and next_c in ["]", ","])
308
309
  ):
@@ -310,12 +311,28 @@ class JSONParser:
310
311
  i += 1
311
312
  next_c = self.get_char_at(i)
312
313
  if next_c == rstring_delimiter:
313
- self.log(
314
- "While parsing a string, we a misplaced quote that would have closed the string but has a different meaning here, ignoring it",
315
- "info",
316
- )
317
- self.index += 1
318
- char = self.get_char_at()
314
+ # But this might not be it! This could be just a missing comma
315
+ # We need to check if we find a rstring_delimiter and a colon after
316
+ i += 1
317
+ next_c = self.get_char_at(i)
318
+ while next_c and next_c != rstring_delimiter:
319
+ i += 1
320
+ next_c = self.get_char_at(i)
321
+ i += 1
322
+ next_c = self.get_char_at(i)
323
+ while next_c and next_c != ":":
324
+ if next_c in [lstring_delimiter, rstring_delimiter, ","]:
325
+ break
326
+ i += 1
327
+ next_c = self.get_char_at(i)
328
+ # Only if we fail to find a ':' then we know this is misplaced quote
329
+ if next_c != ":":
330
+ self.log(
331
+ "While parsing a string, we a misplaced quote that would have closed the string but has a different meaning here, ignoring it",
332
+ "info",
333
+ )
334
+ self.index += 1
335
+ char = self.get_char_at()
319
336
 
320
337
  if (
321
338
  char
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: json_repair
3
- Version: 0.16.0
3
+ Version: 0.16.1
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
@@ -0,0 +1,7 @@
1
+ json_repair/__init__.py,sha256=AlNie5y6BZBioGi5fzTAUvum_y0U5aL5aNsuQ_68LQc,175
2
+ json_repair/json_repair.py,sha256=P3jzLaa70VyyE-kjRhijJ4gEPMXba3FmsocJF7bPB9I,21417
3
+ json_repair-0.16.1.dist-info/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
4
+ json_repair-0.16.1.dist-info/METADATA,sha256=UCkuATUR-x0kFLbunLN_htTmUy5T5ZAzXOFhEVeISNc,7355
5
+ json_repair-0.16.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
6
+ json_repair-0.16.1.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
7
+ json_repair-0.16.1.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- json_repair/__init__.py,sha256=AlNie5y6BZBioGi5fzTAUvum_y0U5aL5aNsuQ_68LQc,175
2
- json_repair/json_repair.py,sha256=XahLp82VVwg8KgyywNxMFBHIPIbvPDp6uWMP1VD_40w,20418
3
- json_repair-0.16.0.dist-info/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
4
- json_repair-0.16.0.dist-info/METADATA,sha256=-OLuKPGwu4enrP7kP2947Gyz9l7JRVpGTRH1b1MB2ZY,7355
5
- json_repair-0.16.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
6
- json_repair-0.16.0.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
7
- json_repair-0.16.0.dist-info/RECORD,,