title: How to create JSON string in JavaScript?
body: <pre><code>window.onload = function(){
      var obj = '{
              "name" : "Raj",
              "age"  : 32,
              "married" : false
              }';
  
      var val = eval('(' + obj + ')');
      alert( "name : " + val.name + "\n" +
             "age  : " + val.age  + "\n" +
             "married : " + val.married );
  
  }
  </code></pre>
  
  <p>In a code something like this, I am trying to create JSON string just to play around. It's throwing error, but if I put all the name, age, married in one single line (line 2) it doesn't. Whats the problem?</p>