How to create javascript array from json data

Hi

how to create javascript array from json data ?

I don’t understand why your wanting to convert from an array to an array, JSON data is stored like any other array expect for the fact you can use periods instead square brackets to call the indexes.

if i pass the json data to google chart it tell error msg like not an array.

If you have it as a JSON string then you need to parse it using JSON.parse() to convert it to code.

if i parse the json it will return as a string how can i convert it to array ?

Using JSON.parse() will convert it to an array, if you could please share your JSON array with us we will be able to help you with any issues it may have.

Using JSON.stringify converts an object or an array to a string. JSON.parse() takes the string and converts it back into an object or an array. These two conversions are all that the static JSON object in JavaScript is there for.

This is my json string get it from php and pass to javascript for google chart


[["Date","sales","expenses"],["02-05-2012","21878","441"],["03-05-2012","20211","436"],["04-05-2012","17234","382"],["05-05-2012","24703","535"],["06-05-2012","25272","542"],["07-05-2012","21041","431"]]