Convert a multidimensional javascript array to JSON?

后端 未结 9 1199
半阙折子戏
半阙折子戏 2020-12-05 09:54

What is the best way of converting a multi-dimensional javascript array to JSON?

9条回答
  •  广开言路
    2020-12-05 09:57

    Not sure I fully understand your question, but if you are trying to convert the object into a string of JSON then you probably want to look at the native JSON support in all the new browsers. Here's Resig's post on it. For browsers that don't yet support it try the json2.js library. JSON.stringify(obj) will convert your object to a string of JSON.

提交回复
热议问题