json-repair 0.29.8__py3-none-any.whl → 0.29.10__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.
@@ -83,7 +83,7 @@ class JSONParser:
83
83
  return self.parse_array()
84
84
  # there can be an edge case in which a key is empty and at the end of an object
85
85
  # like "key": }. We return an empty string here to close the object properly
86
- elif char == "}":
86
+ elif self.context.current == ContextValues.OBJECT_VALUE and char == "}":
87
87
  self.log(
88
88
  "At the end of an object we found a key with missing value, skipping",
89
89
  )
@@ -171,7 +171,8 @@ class JSONParser:
171
171
  arr = []
172
172
  self.context.set(ContextValues.ARRAY)
173
173
  # Stop when you either find the closing parentheses or you have iterated over the entire string
174
- while (self.get_char_at() or "]") != "]":
174
+ char = self.get_char_at()
175
+ while char and char not in ["]", "}"]:
175
176
  self.skip_whitespaces_at()
176
177
  value = self.parse_json()
177
178
 
@@ -317,12 +318,14 @@ class JSONParser:
317
318
  next_c = self.get_char_at(i)
318
319
  if next_c and next_c in [",", "}"]:
319
320
  rstring_delimiter_missing = False
320
- elif char == ",":
321
+ else:
322
+ # skip any whitespace first
323
+ i = self.skip_whitespaces_at(idx=1, move_main_index=False)
321
324
  # We couldn't find any rstring_delimeter before the end of the string
322
325
  # check if this is the last string of an object and therefore we can keep going
323
326
  # make an exception if this is the last char before the closing brace
324
- i = self.skip_to_character(character="}", idx=1)
325
- if i > 1:
327
+ j = self.skip_to_character(character="}", idx=i)
328
+ if j - i > 1:
326
329
  # Ok it's not right after the comma
327
330
  # Let's ignore
328
331
  rstring_delimiter_missing = False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: json_repair
3
- Version: 0.29.8
3
+ Version: 0.29.10
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,13 @@
1
+ json_repair/__init__.py,sha256=IIzSm1DsCRrr8seF3UeMZXwxcq-tE3j-8d1WBxvEJvE,178
2
+ json_repair/__main__.py,sha256=EsJb-y89uZEvGQQg1GdIDWzfDwfOMvVekKEtdguQXCM,67
3
+ json_repair/json_context.py,sha256=DdJu3DJR-ANvr8KrWfJqdtOE3uI6_B0VQidKvE3PjJA,1080
4
+ json_repair/json_parser.py,sha256=C15JIu28XXpXM5U7s4uZoa_iy8eJmRubpGptX5qbr-c,26998
5
+ json_repair/json_repair.py,sha256=GTg3OAXRbAJAHWs8oiQDqUHh4h6qKDVvWPXcrqafzLY,6100
6
+ json_repair/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ json_repair/string_file_wrapper.py,sha256=EHLhNBWoyUitzT08thytYJiNZh_klEFwfT8zutPSdb4,3905
8
+ json_repair-0.29.10.dist-info/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
9
+ json_repair-0.29.10.dist-info/METADATA,sha256=ggtmL_tOk6LpzcdHXB-zLsYudsZima5MHQcdnprfLDc,10687
10
+ json_repair-0.29.10.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
11
+ json_repair-0.29.10.dist-info/entry_points.txt,sha256=SNfge3zPSP-ASqriYU9r3NAPaXdseYr7ciPMKdV2uSw,57
12
+ json_repair-0.29.10.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
13
+ json_repair-0.29.10.dist-info/RECORD,,
@@ -1,13 +0,0 @@
1
- json_repair/__init__.py,sha256=IIzSm1DsCRrr8seF3UeMZXwxcq-tE3j-8d1WBxvEJvE,178
2
- json_repair/__main__.py,sha256=EsJb-y89uZEvGQQg1GdIDWzfDwfOMvVekKEtdguQXCM,67
3
- json_repair/json_context.py,sha256=DdJu3DJR-ANvr8KrWfJqdtOE3uI6_B0VQidKvE3PjJA,1080
4
- json_repair/json_parser.py,sha256=sAsGtUt-LUOXhSxViYDoCsQFINw29O1cmfSchTNfJPs,26793
5
- json_repair/json_repair.py,sha256=GTg3OAXRbAJAHWs8oiQDqUHh4h6qKDVvWPXcrqafzLY,6100
6
- json_repair/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- json_repair/string_file_wrapper.py,sha256=EHLhNBWoyUitzT08thytYJiNZh_klEFwfT8zutPSdb4,3905
8
- json_repair-0.29.8.dist-info/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
9
- json_repair-0.29.8.dist-info/METADATA,sha256=yH1vmRAkZC8knJkMtcbVUSloE2sSMkOFFru-ZKgrhVk,10686
10
- json_repair-0.29.8.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
11
- json_repair-0.29.8.dist-info/entry_points.txt,sha256=SNfge3zPSP-ASqriYU9r3NAPaXdseYr7ciPMKdV2uSw,57
12
- json_repair-0.29.8.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
13
- json_repair-0.29.8.dist-info/RECORD,,