JSON.parse(JSON.stringify(res.msg).replace(/"name"/g,"\"label\"").replace(/"parentId"/g,"\"key\""))
多个往后面拼接就行
JSON.parse(JSON.stringify(res.msg).replace(/"name"/g,"\"label\"").replace(/"parentId"/g,"\"key\""))
多个往后面拼接就行
本文标题:无限嵌套json文件替换key值
本文链接:https://www.haomeiwen.com/subject/spohnltx.html
网友评论