How to convert JSON object to JavaScript array?
var json_data = {"2013-01-21":1,"2013-01-22":7};
var result = [];
for(var i in json_data)
result.push([i, json_data [i]]);
var data = new google.visualization.DataTable();
data.addColumn('string', 'Topping');
data.addColumn('number', 'Slices');
data.addRows(result);
http://jsfiddle.net/MV5rj/
If you have a well-formed JSON string, you should be able to do
var as = JSON.parse(jstring);
I do this all the time when transfering arrays through AJAX.
Suppose you have:
var j = {0: "1", 1: "2", 2: "3", 3: "4"};
You could get the values with (supported in practically all browser versions):
Object.keys(j).map(function(_) { return j[_]; })
or simply:
Object.values(j)
Output:
["1", "2", "3", "4"]