json-repair 0.25.2__tar.gz → 0.25.3__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: json_repair
3
- Version: 0.25.2
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
@@ -3,7 +3,7 @@ requires = ["setuptools>=61.0"]
3
3
  build-backend = "setuptools.build_meta"
4
4
  [project]
5
5
  name = "json_repair"
6
- version = "0.25.2"
6
+ version = "0.25.3"
7
7
  license = {file = "LICENSE"}
8
8
  authors = [
9
9
  { name="Stefano Baccianella", email="4247706+mangiucugna@users.noreply.github.com" },
@@ -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 = ""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: json_repair
3
- Version: 0.25.2
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
@@ -95,6 +95,7 @@ def test_missing_and_mixed_quotes():
95
95
  == '{"name": "John", "age": 30, "city": "New"}'
96
96
  )
97
97
  assert repair_json('[{"key": "value", COMMENT "notes": "lorem "ipsum", sic."}]') == '[{"key": "value", "notes": "lorem \\"ipsum\\", sic."}]'
98
+ assert repair_json('{"key": ""value"}') == '{"key": "value"}'
98
99
 
99
100
  def test_array_edge_cases():
100
101
  assert repair_json("[1, 2, 3,") == "[1, 2, 3]"
File without changes
File without changes
File without changes