Create an object with a function from string using Json parse() - Javascript JSon

Javascript examples for JSon:JSon Parse

Description

Create an object with a function from string using Json parse()

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){/*www.jav  a  2s .  co  m*/
var string = '{"func":"function (field) {var date = getDate(field);return date != -1;}","somethingElse": "Message","somethingElse2":"Message2"}';
var jsonObject = JSON.parse(string);
console.log(jsonObject)
    }

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

Related Tutorials