json-repair 0.17.4__tar.gz → 0.19.0__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.17.4
3
+ Version: 0.19.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
@@ -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.17.4"
6
+ version = "0.19.0"
7
7
  license = {file = "LICENSE"}
8
8
  authors = [
9
9
  { name="Stefano Baccianella", email="4247706+mangiucugna@users.noreply.github.com" },
@@ -178,7 +178,12 @@ class JSONParser:
178
178
  if not value:
179
179
  break
180
180
 
181
- arr.append(value)
181
+ if value == "..." and self.get_char_at(-1) == ".":
182
+ self.log(
183
+ "While parsing an array, found a stray '...'; ignoring it", "info"
184
+ )
185
+ else:
186
+ arr.append(value)
182
187
 
183
188
  # skip over whitespace after a value but before closing ]
184
189
  char = self.get_char_at()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: json_repair
3
- Version: 0.17.4
3
+ Version: 0.19.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
@@ -39,6 +39,9 @@ def test_repair_json():
39
39
  == '{"name": "John", "age": 30, "city": "New York"}'
40
40
  )
41
41
  assert repair_json("[1, 2, 3,") == "[1, 2, 3]"
42
+ assert repair_json("[1, 2, 3, ...]") == "[1, 2, 3]"
43
+ assert repair_json("[1, 2, ... , 3]") == "[1, 2, 3]"
44
+ assert repair_json("[1, 2, '...', 3]") == '[1, 2, "...", 3]'
42
45
  assert (
43
46
  repair_json('{"employees":["John", "Anna",')
44
47
  == '{"employees": ["John", "Anna"]}'
@@ -156,7 +159,6 @@ def test_repair_json_with_objects():
156
159
  "age": 30,
157
160
  "city": "New York",
158
161
  }
159
- assert repair_json("[1, 2, 3,", return_objects=True) == [1, 2, 3]
160
162
  assert repair_json('{"employees":["John", "Anna",', return_objects=True) == {
161
163
  "employees": ["John", "Anna"]
162
164
  }
File without changes
File without changes
File without changes