File tree Expand file tree Collapse file tree 4 files changed +8
-1
lines changed
Expand file tree Collapse file tree 4 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ then you can use use it in your code like this
6464 good_json_string = repair_json(bad_json_string)
6565 # If the string was super broken this will return an empty string
6666
67+
6768You can use this library to completely replace ` json.loads() ` :
6869
6970 import json_repair
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ requires = ["setuptools>=61.0"]
33build-backend = " setuptools.build_meta"
44[project ]
55name = " json_repair"
6- version = " 0.45.0 "
6+ version = " 0.45.1 "
77license = {file = " LICENSE" }
88authors = [
99 {
name =
" Stefano Baccianella" ,
email =
" [email protected] " },
Original file line number Diff line number Diff line change @@ -790,6 +790,11 @@ def parse_comment(self) -> str:
790790 break
791791 self .log (f"Found block comment: { comment } " )
792792 return ""
793+ else :
794+ # Skip standalone '/' characters that are not part of a comment
795+ # to avoid getting stuck in an infinite loop
796+ self .index += 1
797+ return ""
793798 return "" # pragma: no cover
794799
795800 def get_char_at (self , count : int = 0 ) -> str | Literal [False ]:
Original file line number Diff line number Diff line change @@ -83,6 +83,7 @@ def test_general_edge_cases():
8383 assert repair_json ("[[1\n \n ]" ) == "[[1]]"
8484 assert repair_json ("string" ) == ""
8585 assert repair_json ("stringbeforeobject {}" ) == "{}"
86+ assert repair_json ("/" ) == ""
8687
8788
8889def test_mixed_data_types ():
You can’t perform that action at this time.
0 commit comments