Uri query parsing of key with `[]` keyword
Just a discussion. In Rails and PHP, they parse a uri of something like http://localhost:3000/?foo=1&bar[]=2&bar[]=3to Parameters: {"foo"=>"1", "bar"=>["2", "3"]}.
Yet right now we just treat bar[] as a literal string, so:
iex(1)> URI.decode_query("foo=1&bar[]=2&bar[]=3")
%{"bar[]" => "3", "foo" => "1"}
Is one better than another? I will really appreciate any response. :smile:
URI only does a basic parsing, based on &, it does not provide any specific parameter parsing. You can roll your own or use plug (which provides something like PHP/Rails).
And remember to use the mailing list for questions the next time :)
José Valim www.plataformatec.com.br Skype: jv.ptec Founder and Lead Developer
Thanks!
Will do next time.
Is there any reason why URI only does basic parsing? @jw2013 did you find a roll your own library or did you just end up using plug