It’s common to send nested maps or lists via query string even though it is not standardized.
URI.encode_query/2
does not support nested maps or lists and can’t be customized to handle that.
Doumi.URI.Query
supports encoding maps or lists to query string. (only PHP-style now)
iex> query = %{"foo" => %{"bar" => 1, "baz" => 2}}
iex> Doumi.URI.Query.encode(query)
"foo%5Bbar%5D=1&foo%5Bbaz%5D=2" # foo[bar]=1&foo[baz]=2
iex> query = %{"foo" => [1, 2, 3]}
iex> Doumi.URI.Query.encode(query)
"foo%5B%5D=1&foo%5B%5D=2&foo%5B%5D=3" # foo[]=1&foo[]=2&foo[]=3
Thanks!