title: d3.json console.log returns undefined or JSON.parse returns unexpected character at line 1
body: <p>I spend a lot of time trying to solve the errors from this statement to show the content of the json url in the console.log:</p>
  
  <pre><code>d3.json( urlpathtojson, function(error, jsondata ) {
      var jsonfile = JSON.parse(jsondata);
      console.log(jsonfile);
      }):
  </code></pre>
  
  <p>I could see the GET statement and the contents of the JSON request, but the console gave following error:</p>
  
  <pre><code>SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
  </code></pre>
  
  <p>Or in other cases without parsing:</p>
  
  <pre><code>ReferenceError: jsondata is not defined
  </code></pre>
  
  <p>Or</p>
  
  <pre><code>jsondata is undefined
  </code></pre>
  
  <p>Below is the answer which I found on Stackoverflow. Hopefully it will help someone else as well.</p>