Hi,
I am working on displaying my JSON string beautifully using jQuery.
Here is my code:
$(document).ready(function() {
var jsonp = '[{"filename":"4x6_flower.png","count":1,"zones":[{"x":"198","y":"133","width":"1283","height":"820"}]}]';
var obj = jQuery.parseJSON(jsonp);
document.body.innerHTML = "";
document.body.appendChild(document.createTextNode(JSON.stringify(obj, null, "\t")));
});
But output is displayed in a single line like this:
[ { "filename": "4x6_flower.png", "count": 1, "zones": [ { "x": "198", "y": "133", "width": "1283", "height": "820" } ] } ]
What should I do to make it displaying nicely?
(I can only use a js library with absolute url like jQuery - no extra files other than one html file. So please do not recommend me to use wierd js library that needs to be downloaded)