Skip to content

Instantly share code, notes, and snippets.

@lilywang711
Created April 2, 2019 03:41
Show Gist options
  • Save lilywang711/f89d67c6a6b1ca2e8d4a23d5d8fba356 to your computer and use it in GitHub Desktop.
Save lilywang711/f89d67c6a6b1ca2e8d4a23d5d8fba356 to your computer and use it in GitHub Desktop.
url2object
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