{redirect:WECHAT,u:hyadmin,p:Aldadmin@123456},我要生成{"redirect":"WECHAT","u":"hyadmin","p":"Aldadmin@123456"},用js
时间: 2023-11-21 20:58:46 浏览: 101
您可以使用以下JavaScript代码将"{redirect:WECHAT,u:hyadmin,p:Aldadmin@123456}"转换为{"redirect":"WECHAT","u":"hyadmin","p":"Aldadmin@123456"}:
```javascript
const str = "{redirect:WECHAT,u:hyadmin,p:Aldadmin@123456}";
const obj = JSON.parse(str.replace(/(\w+):/g, '"$1":'));
console.log(obj); // 输出:{"redirect":"WECHAT","u":"hyadmin","p":"Aldadmin@123456"}
```
阅读全文