I have a javascript object that I need to flatten into a string so that I can pass as querystring, how would I do that? i.e:
{ cost: 12345, insertBy: \'testUse
Another version:
function toQueryString(obj) { return Object.keys(obj).map(k => { return encodeURIComponent(k) + "=" + encodeURIComponent(obj[k]) }) .join("&"); }