去除数组子对象key的引号

48 阅读1分钟

使用josn 在js中去除引号

数据格式 如下 :

[{ "description": "接口编码",
   "fieldName": "partner",
   "fieldType": "String", 
   "require": true,
   "requireYesOrNo": "Y" },
 { "description": "随机字符串,长度不超过32字符",
   "fieldName": "noncer",
   "fieldType": "String",
   "require": true, 
   "requireYesOrNo": "Y" }]

参考方案

let arr =[{ "description": "接口编码",
            "fieldName": "partner",
            "fieldType": "String", 
            "require": true,
            "requireYesOrNo": "Y" },
          { "description": "随机字符串,长度不超过32字符",
            "fieldName": "noncer",
            "fieldType": "String",
            "require": true, 
            "requireYesOrNo": "Y" }]
            
this.tableData = JSON.parse(JSON.stringify(arr))