What is the best way of converting a multi-dimensional javascript array to JSON?
question from:https://stackoverflow.com/questions/459105/convert-a-multidimensional-javascript-array-to-jsonWhat is the best way of converting a multi-dimensional javascript array to JSON?
question from:https://stackoverflow.com/questions/459105/convert-a-multidimensional-javascript-array-to-jsonMost of the popular JavaScript frameworks have JSON utility functions included. For instance, jQuery has a function that directly calls a url and loads the JSON result as an object : http://docs.jquery.com/Getjson
However, you can get an open-source JSON parser and stringifier from the json website :
https://github.com/douglascrockford/JSON-js
Then, simply include the code and use the JSON.stringify() method on your array.