I have an object with some values as arrays.
let paramObj = {
name: 'title',
properties: [01, 02, 03],
rooms: [01],
city: 'cityname'
}
I want to convert it to url parameters like this
http://localhost:8080/endpoint?name=title&properties=01&properties=02&properties=03&rooms=01&city=cityName
I have some thing which is working fine for normal strings but I want to check if the object key has array than convert it to multiple parameters. here is my code
const qs = Object.keys(paramObj)
.map(key => `${key}=${paramObj[key]}`)
.join('&');