Javascript - sample code of beautify json

5/2/2015·1 min read
<div id="test"></div>
<style>
    #test { white-space: pre; font-family: monospace; }
</style>
<script>
    var qobj = @Html.Raw(JsonConvert.SerializeObject(Model.SomeKindOfObject));
    document.getElementById("test").innerHTML = JSON.stringify(qobj, null, 4);
</script>