var str = "www.baidu.com?id=1&name=zhangsan";
var data = str.split("?");
console.log(data);
var zz = "{\""+data[1].replace(/=/g,"\":\"").replace("&","\",\"")+"\"}";
console.log(zz);
var json = JSON.parse(zz);
console.log(json);
2023-08-19 15:08:16
var str = "www.baidu.com?id=1&name=zhangsan";
var data = str.split("?");
console.log(data);
var zz = "{\""+data[1].replace(/=/g,"\":\"").replace("&","\",\"")+"\"}";
console.log(zz);
var json = JSON.parse(zz);
console.log(json);
下一篇:Node节点