title: JSON.parse: unexpected character
body: <p>i have an json array and i want to parse it in java-script but my jquery gives me following error:</p>
  
  <pre><code>JSON.parse: unexpected character 
  </code></pre>
  
  <p>The code in jquery is,on which the error comes:</p>
  
  <pre><code>// Attempt to parse using the native JSON parser first
  if ( window.JSON &amp;&amp; window.JSON.parse ) {//error comes on this line.
  return window.JSON.parse( data );
  } 
  </code></pre>
  
  <p>My code is:</p>
  
  <pre><code>success: function(msg){
                  var test= JSON.parse(msg);
                  var question=test.question;
          document.getElementById('question').value=question;
  </code></pre>
  
  <p>I am using the latest version of jquery</p>
  
  <pre><code> &lt;script src="http://code.jquery.com/jquery-latest.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>I am getting this in function(msg):</p>
  
  <pre><code>[Object { question=
  
  "What is your religious affiliation?"
  
  ,  userQuestionCategoryId=
  
  "1"
  
  }]
  </code></pre>
  
  <p>Here is my Php code:</p>
  
  <pre><code>function getquest()
          {
               $id=$this-&gt;input-&gt;post('qid');
               $data=$this-&gt;adminsetting-&gt;getquestion($id);
               if(count($data)&gt;0)
               //echo $data[0]-&gt;question; 
               echo json_encode($data);
               else
               echo "No Question In database";
          }
  </code></pre>
  
  <p>Thanks in advance.</p>