Hi
how to create javascript array from json data ?
| SitePoint Sponsor |
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.
Blog/Portfolio | Evolution Xtreme | DFG Design | DFG Hosting | CSS-Tricks | Stack Overflow | Paul Irish
Having lame problems with your code? Let us help by using a jsFiddle
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.
Stephen J Chapman
javascriptexample.net, Book Reviews, follow me on Twitter
HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
<input name="html5" type="text" required pattern="^$">
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.
Blog/Portfolio | Evolution Xtreme | DFG Design | DFG Hosting | CSS-Tricks | Stack Overflow | Paul Irish
Having lame problems with your code? Let us help by using a jsFiddle

Stephen J Chapman
javascriptexample.net, Book Reviews, follow me on Twitter
HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
<input name="html5" type="text" required pattern="^$">
This is my json string get it from php and pass to javascript for google chart
Code:[["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"]]
Bookmarks