Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
require 'uri'
url = ''
uri = URI.parse(url)
decoded_query = URI.decode_www_form(uri.query)
pp decoded_query, decoded_query.class
decoded_query_hash = Hash[decoded_query]
pp decoded_query_hash, decoded_query_hash.class

This comment has been minimized.

Copy link
Owner Author

@kyanny kyanny commented Aug 22, 2021

❯ ruby uri.rb
[["foo", "1"], ["bar", "2"]]
{"foo"=>"1", "bar"=>"2"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment