Create array from json encode script without double quotes - Javascript JSon

Javascript examples for JSon:JSon String

Description

Create array from json encode script without double quotes

Demo Code

ResultView the demo in separate window

<html>
   <head></head>
   <body> 
      <script>
var artistJSON = JSON.parse('["31","41","56","38","","27"]')
                     .map(function (e) { return parseInt(e); })
                     .filter(function (e) { return isFinite(e) });
console.log(artistJSON, typeof artistJSON[0]);

      </script>  
   </body>/*from   w  w w  .  ja  v a  2  s .c  o  m*/
</html>

Related Tutorials