var url = `http://localhost:8080/list?emp[0].id=21&emp[0].name=john&emp[1].id=22&emp[1].name=tom`;
var data = url.split('?')[1].split('&');
var result = Object.values(data.reduce((acc, elem)=>{
key = elem.match(/d+/)[0];
kv = elem.split(".")[1].split('=');
acc[key] = {...(acc[key] || []), ...{[kv[0]]:kv[1]}}
return acc;
},{}));
console.log(result);
var url = `http://localhost:8080/list?emp[0].id=21&emp[0].name=john&emp[1].id=22&emp[1].name=tom`;
var data = url.split('?')[1].split('&');
var result = Object.values(data.reduce((acc, elem)=>{
key = elem.match(/d+/)[0];
kv = elem.split(".")[1].split('=');
acc[key] = {...(acc[key] || []), ...{[kv[0]]:kv[1]}}
return acc;
},{}));
console.log(result);