Is there a better way to convert a URL's location.search as an object? Maybe just more efficient or trimmed down? I'm using jQuery, but pure JS can work too.
var query = window.location.search.substring(1), queryPairs = query.split('&'), queryJSON = {};
$.each(queryPairs, function() { queryJSON[this.split('=')[0]] = this.split('=')[1]; });
Probably the shortest solution for simple cases:
My approach, simple and clean
JSON Parse after stringify does the job of converting to a json with array data.
?key1=val1&key2[]=val2.1&key2[]=val2.2&key2[]=val2.3&