Brackets in query parameters

How does one handle brackets in querystring parameters when passing a URL in GET request?

I’m dealing with an API that has the following query parameters: page and q[country_code].

Normally I put these in a map and encode them using URI.encode_www_form/1, but I’m not sure how to deal with these brackets.

Is there a common way of handling them, or do I need to do something like this:

def pair({key, value}) do
  param_name = to_string(key) |> URI.www_form_encode()
  param_value = to_string(value) |> URI.www_form_encode()
  "q[#{param_name}]=#{param_value}"
end

plug has a method to deal with this. Plug.Conn.Query.decode/1 I think.