const qs = `?dd-products%5B0%5D%5Bproduct-id%5D=16&add-products%5B0%5D%5Bquantity%5D=5&add-products%5B0%5D%5Bprice%5D=25.000&add-products%5B1%5D%5Bproduct-id%5D=17&add-products%5B1%5D%5Bquantity%5D=7&add-products%5B1%5D%5Bprice%5D=84.000&add-products%5B2%5D%5Bproduct-id%5D=15&add-products%5B2%5D%5Bquantity%5D=10&add-products%5B2%5D%5Bprice%5D=100.000&product-name=0&quantity=0&price=0&object_id=31`
const params = new URLSearchParams(qs)
const obj = {}
for (const key of params.keys()) {
if (params.getAll(key).length > 1) {
obj[key] = params.getAll(key)
} else {
obj[key] = params.get(key)
}
}
console.log(obj)
// { product-id: ' 5', quantity: '10 ', price : ' 100', product-name:' 0' ,sort: 'ASE' }