But my goal is to maintain the original format (without losing "href" and "class").
It works if I use single quotes, but in this case I'm getting exception from sql because it cannot parse this to JSON:
HtmlSanitizer sanitizes only HTML, not JSON. I suggest deserializing the JSON, then sanitize the value of the content property and possibly serialize back to JSON or use in another way according to your use case.
Hi,
I am using the HtmlSanitization library in my project. I have a property jsonColumn (which type is JSON) with the following value:
And after sanitizing I'm getting this result (even when I have "class" as an allowed attribute):
But my goal is to maintain the original format (without losing "href" and "class"). It works if I use single quotes, but in this case I'm getting exception from sql because it cannot parse this to JSON:
I would appreciate any suggestions on how to resolve this issue. Thanks.