let str1 = 'http://item.taobao.com/item.htm?a=1&b=2&c=&d=xxx&e=undefined' function unique(str) { let json = {} let arr = str.split('?')[1].split('&') for (var i = 0; i < arr.length; i++) { let arr1 = arr[i].split('=') json[arr1[0]] = arr1[1] } return json }