json-repair 0.22.0__py3-none-any.whl → 0.23.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.
@@ -89,10 +89,25 @@ class JSONParser:
89
89
  def parse(
90
90
  self,
91
91
  ) -> Union[JSONReturnType, Tuple[JSONReturnType, List[Dict[str, str]]]]:
92
+ json = self.parse_json()
93
+ if self.index < len(self.json_str):
94
+ json = [json]
95
+ last_index = self.index
96
+ while self.index < len(self.json_str):
97
+ j = self.parse_json()
98
+ if j != "":
99
+ json.append(j)
100
+ if self.index == last_index:
101
+ self.index += 1
102
+ last_index = self.index
103
+ if len(json) == 1:
104
+ json = json[0]
105
+ elif len(json) == 0:
106
+ json = ""
92
107
  if self.logger.log_level == "none":
93
- return self.parse_json()
108
+ return json
94
109
  else:
95
- return self.parse_json(), self.logger.log
110
+ return json, self.logger.log
96
111
 
97
112
  def parse_json(
98
113
  self,
@@ -306,14 +321,6 @@ class JSONParser:
306
321
  "While parsing a string, we found a literal instead of a quote",
307
322
  "info",
308
323
  )
309
- if self.get_context() == "":
310
- # A string literal in the wild isn't a valid json and not something we can fix
311
- self.log(
312
- "While parsing a string, we found a literal outside of context, ignoring it",
313
- "info",
314
- )
315
- self.index += 1
316
- return self.parse_json()
317
324
  self.log(
318
325
  "While parsing a string, we found no starting quote. Will add the quote back",
319
326
  "info",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: json_repair
3
- Version: 0.22.0
3
+ Version: 0.23.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=IIzSm1DsCRrr8seF3UeMZXwxcq-tE3j-8d1WBxvEJvE,178
2
+ json_repair/json_repair.py,sha256=3OUrtLLPc0fK0_U6H5-2wEZp1I6GqF5u9K5It6VOIzM,27629
3
+ json_repair-0.23.1.dist-info/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
4
+ json_repair-0.23.1.dist-info/METADATA,sha256=ujJO8L3zXSI8SRrZSF8qkcAaM8aj7XHWgx88x_OAnmA,7333
5
+ json_repair-0.23.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
6
+ json_repair-0.23.1.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
7
+ json_repair-0.23.1.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- json_repair/__init__.py,sha256=IIzSm1DsCRrr8seF3UeMZXwxcq-tE3j-8d1WBxvEJvE,178
2
- json_repair/json_repair.py,sha256=r3Vx2rhFwqL201vXB5hgiJR2zLll_Rx4cn1_xKnLSTo,27501
3
- json_repair-0.22.0.dist-info/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
4
- json_repair-0.22.0.dist-info/METADATA,sha256=D8wdIzgpU3n8Wzwv9_qCsiNsi5410vq7ouOR7l9zke0,7333
5
- json_repair-0.22.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
6
- json_repair-0.22.0.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
7
- json_repair-0.22.0.dist-info/RECORD,,