Unnecessary Escaping of '&' Character in sanitizeJSON Function
kiyopikko opened this issue · 1 comments
kiyopikko commented
Thank you for great project!
I've encountered an issue with the sanitizeJSON
function, where it unnecessarily escapes the &
character. This behavior seems to be causing issues when parsing JSON strings.
export const sanitizeJSON = (unsanitized: string) => {
return unsanitized
.replace(/\\/g, "\\\\")
.replace(/\n/g, "\\n")
.replace(/\r/g, "\\r")
.replace(/\t/g, "\\t")
.replace(/\f/g, "\\f")
.replace(/"/g, '\\"')
.replace(/\&/g, "\\&"); // this line
};
If I've misunderstood something, I apologize 🙇