如果本文对您有帮助,希望点个赞,建立下友谊关系。

将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);

 

posted @ 2017-07-13 15:00  一只喵喵  阅读(1917)  评论(0编辑  收藏  举报