Created
August 25, 2014 01:10
-
-
Save JulienSansot/656c396fab947a462e4e to your computer and use it in GitHub Desktop.
printing javascript object in the page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div> | |
</div> | |
<script> | |
var o = { | |
test1 : 50, | |
test2 : 'Test', | |
test3: { | |
test4: 'test1', | |
test5: [1,2,3] | |
} | |
}; | |
var str = JSON.stringify(o, null, 6); | |
str = str.replace(/\n/g, '<br/>').replace(/ /g, ' ').replace(/"/g, ""); | |
$("div").html(str); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment