json-repair 0.25.1__py3-none-any.whl → 0.25.3__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.
@@ -352,6 +352,19 @@ class JSONParser:
352
352
  )
353
353
  doubled_quotes = True
354
354
  self.index += 1
355
+ else:
356
+ # Ok this is not a doubled quote, check if this is an empty string or not
357
+ i = 1
358
+ next_c = self.get_char_at(i)
359
+ while next_c and next_c.isspace():
360
+ i += 1
361
+ next_c = self.get_char_at(i)
362
+ if next_c not in [",", "]", "}"]:
363
+ self.log(
364
+ "While parsing a string, we found a doubled quote but it was a mistake, removing one quote",
365
+ "info",
366
+ )
367
+ self.index += 1
355
368
 
356
369
  # Initialize our return value
357
370
  string_acc = ""
@@ -513,15 +526,15 @@ class JSONParser:
513
526
  break
514
527
  i += 1
515
528
  next_c = self.get_char_at(i)
516
- # Only if we fail to find a ':' then we know this is misplaced quote
517
- if next_c != ":":
518
- self.log(
519
- "While parsing a string, we a misplaced quote that would have closed the string but has a different meaning here, ignoring it",
520
- "info",
521
- )
522
- string_acc += char
523
- self.index += 1
524
- char = self.get_char_at()
529
+ # Only if we fail to find a ':' then we know this is misplaced quote
530
+ if next_c != ":":
531
+ self.log(
532
+ "While parsing a string, we a misplaced quote that would have closed the string but has a different meaning here, ignoring it",
533
+ "info",
534
+ )
535
+ string_acc += char
536
+ self.index += 1
537
+ char = self.get_char_at()
525
538
 
526
539
  if (
527
540
  char
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: json_repair
3
- Version: 0.25.1
3
+ Version: 0.25.3
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
@@ -35,6 +35,11 @@ Requires-Python: >=3.7
35
35
  Description-Content-Type: text/markdown
36
36
  License-File: LICENSE
37
37
 
38
+ [![PyPI](https://img.shields.io/pypi/v/json-repair)](https://pypi.org/project/json-repair/)
39
+ ![Python version](https://img.shields.io/badge/python-3.7+-important)
40
+ [![PyPI downloads](https://img.shields.io/pypi/dm/json-repair)](https://pypi.org/project/json-repair/)
41
+
42
+
38
43
  This simple package can be used to fix an invalid json string. To know all cases in which this package will work, check out the unit test.
39
44
 
40
45
  Inspired by https://github.com/josdejong/jsonrepair
@@ -0,0 +1,7 @@
1
+ json_repair/__init__.py,sha256=IIzSm1DsCRrr8seF3UeMZXwxcq-tE3j-8d1WBxvEJvE,178
2
+ json_repair/json_repair.py,sha256=0_vEOcEDZ_MySf_6pyqWPzXKyLZTDPxOwyFSoqu9S8M,31586
3
+ json_repair-0.25.3.dist-info/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
4
+ json_repair-0.25.3.dist-info/METADATA,sha256=AFNOs4gVCu9m-hbsx0FayipLhGixE_GJpsVwgxyjOVE,7863
5
+ json_repair-0.25.3.dist-info/WHEEL,sha256=Z4pYXqR_rTB7OWNDYFOm1qRk0RX6GFP2o8LgvP453Hk,91
6
+ json_repair-0.25.3.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
7
+ json_repair-0.25.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (70.1.0)
2
+ Generator: setuptools (70.3.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,7 +0,0 @@
1
- json_repair/__init__.py,sha256=IIzSm1DsCRrr8seF3UeMZXwxcq-tE3j-8d1WBxvEJvE,178
2
- json_repair/json_repair.py,sha256=PbfthTey1p04_9Q3QRGm8We1ueFVYwO5kQUShpfR10Y,30961
3
- json_repair-0.25.1.dist-info/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
4
- json_repair-0.25.1.dist-info/METADATA,sha256=QjbXE09AIfd70scALY8DPIBxg0TYTBlKg3KuJ7MAMRw,7596
5
- json_repair-0.25.1.dist-info/WHEEL,sha256=cpQTJ5IWu9CdaPViMhC9YzF8gZuS5-vlfoFihTBC86A,91
6
- json_repair-0.25.1.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
7
- json_repair-0.25.1.dist-info/RECORD,,