Answers for "urlsearchparams to object"

1

javascript urlsearchparams to object

var search = location.search.substring(1);
JSON.parse('{"' + decodeURI(search).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g,'":"') + '"}')
Posted by: Guest on September-23-2020
0

urlsearchparams to object

JSON.parse('{"' + decodeURI("abc=foo&def=%5Basf%5D&xyz=5".replace(/&/g, "\",\"").replace(/=/g,"\":\"")) + '"}')
Posted by: Guest on April-06-2021
0

urlsearchparams to object

var search = location.search.substring(1);
JSON.parse('{"' + search.replace(/&/g, '","').replace(/=/g,'":"') + '"}', function(key, value) { return key===""?value:decodeURIComponent(value) })
Posted by: Guest on April-06-2021

Code answers related to "urlsearchparams to object"

Browse Popular Code Answers by Language