var str = "name=张三&sex=1&address=中国";var arr = str.split("&");//["name=张三", "sex=1", "address=中国"]var obj = {};for(var i = 0; i < arr.length; i++) {var arr2 = arr[i].split("=");//["name", "张三"]["sex", "1"]["address", "中国"]obj[arr2[0]] = arr2[1];}console.log(obj);//{name: "张三", sex: "1", address: "中国"}