I would love to put HTML markups (created dynamically by ProcessWire) in a JSON file. Then I could reach it by an ajax call.
I know that I have to escape double quotes in the html string by adding "\" like below.
{
"title": "Title",
"data": "<main id=\"container\"><div class=\"my-class\">My data created my ProcessWire templates</div></main>"
}
But I don't know how to do it dynamically. There is a ProcessWire trick? or sould I write my own function?