title: json_encode adding too many double quotes
body: <p>I am working on a PHP web service that returns data in JSON form. I am at a point where I am now testing the web service with a jQuery/javascript file. It seems to be making the calls and receiving data correctly but the return values from the server seem to have too many double quotes. </p>
  
  <p>PHP:</p>
  
  <pre><code>public static function getToken($username, $password)
          {
              $token = AuthenticationController::authenticate($username, $password);
  
              if ($token)
              {
                  $user = AuthenticationController::getUserFromToken($token);
  
                  if (UserController::userIsVerified($user-&gt;id))
                  {
                      $t = array('token' =&gt; $token);
  
                      return json_encode($t);
                  }
  
                  return json_encode(array('error' =&gt; 'This account has not been verified. Check email and click the provided link to verify the account.'));
              }
  
              return json_encode(array('error' =&gt; 'Authentication failed.'));
          }
  </code></pre>
  
  <p>JS:</p>
  
  <pre><code>req.done(function(msg)
          {
              if (msg.error)
              {
                  error = true;
                  message = msg.error;
              }
              else if (msg.message)
              {
                  message = msg.message;
              }
              else if (msg.token)
              {
                  token = msg.token;
              }
              else 
              {
                  error = true;
                  message = "An unknown error has occured.";
              }
          });
  </code></pre>
  
  <p>For one, the <code>msg</code> object is not coming back as a JSON object but instead it comes in as a string, so I have to do a <code>$.parseJSON(msg)</code> on it. What you see below, the token variable ends up writing out to be  "mylongtoken" (quotes included). And if you look at that variable in firebug, it is like this: ""mylongtoken"". Is this just default behavior and I need to strip the quotes out? </p>