encode object json angualr query parameters code example
Example 1: javascript object to params string
var queryString = Object.keys(params).map(key => key + '=' + params[key]).join('&');
Example 2: javascript convert object to querystring
const queryString = new URLSearchParams(props.location.search);
//or
var queryString = Object.keys(params).map(key => key + '=' + params[key]).join('&');
//Extracting query String key value pairs
for (let param of queryString.entries()) {
console.log(param);
}