title: Parsing an enumerated array of arrays from a string in javascript
body: <p>I am using Google charts and am trying to switch out the data using javascript.</p>
  
  <p>The data itself is generated on the server from a SQL database. It is then formatted into a string (I can format this however I want) and given to the browser in response to AJAX requests.</p>
  
  <p>Unfortunately I haven't been able to use JSON to create an array that matches the format used by Google charts. This is an example of the way that I would write the variable if it was being generated directly in javascript: <code>["United States of America", 7.0287],["Canada", 7.3005],["Australia", 6.8945]</code></p>
  
  <p>So, this is an array of arrays, and both arrays are enumerated rather than associative. JSON seems to work much better with associative arrays than with enumerated ones.</p>
  
  <p>I've tried using jQuery's parseJSON() function, as well as the JSON2.js library.</p>
  
  <pre><code>var sourceData = '["United States of America", 7.0287],["Canada", 7.3005]';
  //(the source data is usually pulled by AJAX, but comes in this format)
  var resultArray = new Array();
  
  resultArray = JSON.parse(sourceData); //doesn't work
  
  resultArray = $.parseJSON(sourceData); //doesn't work
  </code></pre>
  
  <p>Any ideas?</p>