Is it possible to write an HTML string inside JSON?
Which I want to write like below in my JSON file:
[
{
\"id\": \"services.html\",
Lets say I'm trying to render the below HTML.
Go to this website let myHTML = "
JSON.parse(JSON.stringify(myHTML))
This would give you a HTML element which you can set using innerHTML.
Like this
document.getElementById("demo").innerHTML = JSON.parse(JSON.stringify(myHTML));
People are storing their HTML as an object here. However the method I suggested does the same without having to use an Object.