You can define the second parameter in the getData function, pass para as the second parameter, set .textContent of para as a result of JSON.stringify() with jsonc passed as parameter or jsonc[0].VALUE , pass para to .appendChild() , to add an element to document
Javascript
para.className = "json";
// pass `para` to `getData()` call callback(httpRequest.responseText, para);
// `element`: `para` passed at `callback` getData(function(data, element) { var jsonc = JSON.parse(data); element.textContent = JSON.stringify(jsonc, null, 4); // or `jsonc[0].VALUE` document.body.appendChild(element); debugger; });
CSS
p.json { white-space: pre; }
source share