I am writing some website parser and analyzer.
And I am building a JSON object from parsed parameters.
For example a website has title
Buy best phones from "NOKIA COMPANY LTD"
As you can see title has double quote symbol: "
So when I parse title, I get this:
Buy best phones from \"NOKIA COMPANY LTD\" and call anyone
Then I generate a JSON object which will be used by frontend developers. I am using JSON newton soft library like this =
var obj = new
{
Title = parsedTitle,
H1 = "some h1"
};
JsonConvert.SerializeObject(obj, settings);
And as and out put I get not valid json, so frontend developers get an error.
Output JSON will be something like:
{
"title": " Buy best phones from \\"
NOKIA COMPANY LTD\\" and call anyone",
"h1:: "some h1"
}
As you can see it is not valid JSON. What do I do?