将json数据转换成数组,或者将数组转换成json数据
1、json数据为:
data.textfield = "[{"TFC":"@CSS","TFM":"css"},{"TFC":"@Body","TFM":"body"},{"TFC":"@Script","TFM":"script"}]";
将它转换成数组就是:var textfield = JSON.parse(data.textfield);
2、数组为:
var textfield = [
{"TFC":"@CSS","TFM":"css"},
{"TFC":"@Body","TFM":"body"},
{"TFC":"@Script","TFM":"script"}
];
将它转换成json:
data.textfield = JSON.stringify(textfield);