Convert a multidimensional javascript array to JSON?

Most 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.

Leave a Comment