title: parsing JSON using jquery
body: <p>I'm trying to parse a simple JSON file. I'm very new to javascript, JSON, and jquery. I'd like to extract the information in the JSON file so that I can plot it later using protovis. My JSON is well formed, and validates in the <a href="http://www.jsonlint.com/" rel="nofollow">JSON lint</a>. </p>
  
  <p>I'm trying to accomplish this by parsing the JSON object's responseText, like this:</p>
  
  <pre><code>var json = $.getJSON("week_13.json").responseText;
  var week13 = $.parseJSON(json);
  </code></pre>
  
  <p>in the hope that week13 is something I can access. Just to note, I'm not trying to use a callback function in the <code>$.getJSON</code> call as I'd like to simply have access to the variables so that I can plot them later. </p>
  
  <p>I'm using Chrome, and its console, to try and figure out what's going on. In this code the variable <code>json</code> seems to be an empty string. However, if I write in the javascript console in Chrome:</p>
  
  <pre><code>var json = $.getJSON("week_13.json");
  </code></pre>
  
  <p><code>json</code> is an <code>XMLHttpRequest</code> object and its <code>responseText</code> attribute is a big string containing my JSON.</p>
  
  <pre><code>var text = json.responseText;
  </code></pre>
  
  <p>is a nice string and then if I call jquery's parser</p>
  
  <pre><code>var data = $.parseJSON(text);
  </code></pre>
  
  <p>then <code>data</code> is now the object I desired. However, if I copy and paste my original two lines into the console I have no luck, and if I use the expanded version froming the <code>json</code>, <code>text</code> and <code>data</code> variables in my original webpage it doesn't work:</p>
  
  <pre><code>var json = $.getJSON("week_13.json");
  var text = json.responseText;
  var data = $.parseJSON(json);
  </code></pre>
  
  <p>In this case <code>text</code> is an empty string.</p>
  
  <p>I'm totally confused. If anyone could let me know what I'm doing wrong and give some pointers as to how to make this work, I'd be very happy! Please let me know if any other information as to how I'm going about this is required to answer the question!</p>