def json_replace(self, json_string):
json_string = json_string.replace('\\', '\\\\')
json_string = json_string.replace('\x0d\x0a\x0d\x0a', '')
pattern = r'\["(.*?)"]'
matches = re.findall(pattern, json_string)
if matches:
for i in matches:
str1 = i
str2 = i
str2 = str2.replace('"', '“')
str2 = str2.replace('\'', '”')
json_string = json_string.replace(str1, str2)
return json_string
json.loads(json_replace(text), strict=False)
网友评论