我有一个二维数组,包含我需要保存到本地存储的信息,然后再检索。这是我的数据:
var content_array = [
["0","Mobile Application Development","CT5006","01/14/2013","Note"],
["1","Java Programming","CT5005","01/16/2013","Note"],
["2","Multimeida Application Development","CT5011","02/13/2013","Note"]
];
任何简单的方法将其转换为字符串然后再转换为2D数组?
答案 0 :(得分:8)
使用原生JSON.stringify
方法:
var str = JSON.stringify(content_array);
然后,您可以使用JSON.parse
方法将其恢复为实际数组:
var content_array = JSON.parse(str);