diff --git a/src/json_repair/json_parser.py b/src/json_repair/json_parser.py index d9a6aff..cda7c77 100644 --- a/src/json_repair/json_parser.py +++ b/src/json_repair/json_parser.py @@ -308,6 +308,9 @@ def parse_string(self) -> Union[str, bool, None]: rstring_delimiter_missing = True # check if this is a case in which the closing comma is NOT missing instead i = self.skip_to_character(character=rstring_delimiter, idx=1) + # If the rstring_delimeter is escaped then it's not what we are looking for + while self.get_char_at(i - 1) == "\\": + i = self.skip_to_character(character=rstring_delimiter, idx=i + 1) next_c = self.get_char_at(i) if next_c: i += 1 @@ -411,6 +414,11 @@ def parse_string(self) -> Union[str, bool, None]: ): i += 1 i = self.skip_to_character(character=rstring_delimiter, idx=i) + # If the rstring_delimeter is escaped then it's not what we are looking for + while self.get_char_at(i - 1) == "\\": + i = self.skip_to_character( + character=rstring_delimiter, idx=i + 1 + ) next_c = self.get_char_at(i) # Ok now I found a delimiter, let's skip whitespaces and see if next we find a } i += 1 @@ -433,6 +441,11 @@ def parse_string(self) -> Union[str, bool, None]: i = self.skip_to_character( character=rstring_delimiter, idx=i ) + # If the rstring_delimeter is escaped then it's not what we are looking for + while self.get_char_at(i - 1) == "\\": + i = self.skip_to_character( + character=rstring_delimiter, idx=i + 1 + ) i += 1 next_c = self.get_char_at(i) while next_c and next_c != ":":