Manipulating JSON data sets with $.map() function - Javascript jQuery

Javascript examples for jQuery:Json

Description

Manipulating JSON data sets with $.map() function

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){//w  ww  . jav  a 2 s .co m
myarr = [{ "a":"", "b":"test 1"},
         { "q":"", "b":"test 2"},
         { "g":"", "b":"test 3"},
         { "h":"", "d":"not this"}
        ];
var b_arr = $.map(myarr, function(val, i) { return val.b });
console.log(b_arr)
    });

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

Related Tutorials