Parsing a JSON object to get column data - Javascript JSon

Javascript examples for JSon:JSon Parse

Description

Parsing a JSON object to get column data

Demo Code

ResultView the demo in separate window

<html>
   <head></head>
   <body> 
      <p id="demo"></p> 
      <script>
var text = '{\"data\":[[\"X\",\"Y\",\"Z\"],[\"52\",\"23\",\"10\"],[\"46\",\"65\",\"32\"]]}';
var out = "";
obj = JSON.parse(text);/*from www  .  j  a v a2 s.  com*/
arr = obj.data;
console.log(arr);
for(i = 0; i < arr.length; i++) {
        out += arr[i][0] + "<br>";
}
document.getElementById("demo").innerHTML = out;

      </script>  
   </body>
</html>

Related Tutorials