Skip to content

Instantly share code, notes, and snippets.

@aroc
Created February 9, 2015 17:25
Show Gist options
  • Save aroc/18a0824b5b1bffb9153e to your computer and use it in GitHub Desktop.
Save aroc/18a0824b5b1bffb9153e to your computer and use it in GitHub Desktop.
Parse URL into object
var search = location.search.substring(1);
JSON.parse('{"' + decodeURI(search).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g,'":"') + '"}');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment