title: Debugging invisible JSON errors using php encoded variables, parsed with jQuery
body: <p>I'm using php json_encode to send a bunch of values to a client, where jquery </p>
  
  <pre><code>{"data":{"application":{"basics":{"email":"jepp@mily.com","name_first":"Step","name_last":"Bob","phone":"9210938102938","occupation":"unemployed","website":"wwwcom"},"application":{"title":"Default title","guid":"9as8ua9sd8ua9sdu","language":"sv"},"job":{"title":"joburl","url":"joburl"},"letter":{"letter":"abadbabkbakbakbakbakbakbabk"},"work-experiences":[{"title":"Default WORK Experience Title","url":"wwwsscom","date_from":"1970-01-01","date_to":"1999-12-31"},{"title":"Default WORK Experience Title","url":"wwwsscom","date_from":"1970-01-01","date_to":"1999-12-31"},{"title":"Default WORK Experience Title","url":"wwwsscom","date_from":"1970-01-01","date_to":"1999-12-31"}],"educations":{"title":"Default Education","url":"ixi","date_from":"1970-01-01","date_to":"1999-12-31"},"skills":{"title":"Defailt SKILL","url":"wwwsdcom","date_from":"ixi","date_to":"ixi"},"work-samples":{"title":"A sample of my work","url":"wwwsdcom","date_from":"ixi","date_to":"1999-12-31"}}},"error":[],"warning":[]}
  </code></pre>
  
  <p>If I try to parse this with <code>$.parseJSON</code> in a script I get no object. However, if I copy/paste it directly into the console (and add ' in the beginning and end), it works. There are no error codes and I can see no linebreaks. JSON lint-tools returns no errors...</p>
  
  <p>I have set the correct content type and tried the different json parsers that jquery provides. </p>
  
  <p>What have I missed?</p>
  
  <hr>
  
  <p>The code was cut/pasted from the jQuery tutorials. I tried some different examples but they all failed.</p>
  
  <pre><code>var jqxhr = $.getJSON( "application_controller.php", function() {
      console.log( "success" );
  })
  .done(function() {
      console.log( "second success" );
  })
  .fail(function() {
      console.log( "error" );
  })
  .always(function(data) {
      console.log( "complete" );
      application = data;  
  });
  
  // Perform other work here ...
  
  // Set another completion function for the request above
  jqxhr.complete(function() {
      console.log( "second complete" );
  });
  });
  </code></pre>
  
  <hr>
  
  <p>It's true, I decoded it in the console. this is a snippet that does in in-script (it also won't work):</p>
  
  <pre><code>$.ajax({
    dataType: "json",
    contentType: "application/json",
    url: 'application_controller.php',
    data: '{id:id}',
    success: function( data ) {
          application = data.responseText;
          application = $.parseJSON(application);/* &lt; string */     
      },
      fail: console.log("fail"),
      complete: function(data) {
          console.log(data.responseText);
          application = data.responseText;
      }
  });
  </code></pre>