Skip to content

Instantly share code, notes, and snippets.

@mgeeky
Created March 31, 2016 12:31
Show Gist options
  • Save mgeeky/69f00d2a4b4614f7104d931825313317 to your computer and use it in GitHub Desktop.
Save mgeeky/69f00d2a4b4614f7104d931825313317 to your computer and use it in GitHub Desktop.
Convert urlencoded string into dictonary (json)
def urlencoded2dict(txt):
s = '{' + re.sub("([^=]+)=([^&]*)&?", r'"\1":"\2", ', txt) + '}'
return json.loads(s.replace(', }', '}'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment