Javascript examples for JSon:JSon Convert
Convert array to Json in an easy to read format
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){//from ww w . jav a2 s . co m var myArray = {}; myArray['1'] = []; myArray['2'] = []; myArray['3'] = []; for(i=0; i<10; i++){ myArray['1'].push(i); myArray['2'].push(i); myArray['3'].push(i); } console.log( JSON.stringify(myArray,null,4) ); // null,4 provides easy to read formating } </script> </head> <body> </body> </html>