I am building middleware for an API in Javascript. I try to show my Javascript in JSON, but I show only the raw text. I need the JSON format for the external application.
Example code:
var obj = new Object();
obj.name = "Raj";
obj.age = 32;
obj.married = false;
var jsonString= JSON.stringify(obj);
console.log(jsonString);
document.getElementById("test").innerText = jsonString;
What I get:
What I want:
I hope that somebody can help me :)