Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js query string from object

const params = {lat: 35.681236, lng: 139.767125, zoom: 15};
new URLSearchParams(params).toString();
// "lat=35.681236&lng=139.767125&zoom=15"

// OR

const queryString = Object.keys(params).map(key => {
  encodeURIComponent(key) + '=' + encodeURIComponent(params[key])
}).join('&');
 
PREVIOUS NEXT
Tagged: #js #query #string #object
ADD COMMENT
Topic
Name
9+6 =