<script type="text/javascript" src="http://www.json.org/json.js"></script>
<script type="text/javascript">
var Beatles = new Object();
Beatles.Country = "England";
Beatles.YearFormed = 1959;
Beatles.Style = "Rock'n'Roll";
function prevJSON() {
var win = window.open(" ", "_new");
win.document.open();
win.document.write("<pre>" + JSON.stringify(Beatles, null, '\t') + "</pre>"); }
</script>
<input type="button" value="preview JSON code" onClick="prevJSON()">
References:
http://www.learn-ajax-tutorial.com/Json.cfm