way to make json object
<script>
var main = new Array();
sub = new Object();
sub['key1'] = 'value1';
sub['key2'] = 'value2';
sub['key3'] = 'value3';
main[0] = sub;
sub = new Object();
sub['key1'] = 'value4';
sub['key2'] = 'value5';
sub['key3'] = 'value6';
main[1] = sub;
var jsonObject = {list:main};
alert(JSON.stringify(jsonObject));
</script>
No comments:
Post a Comment