Pass a nested array to the params argument inside Craft's url() function I have a list of checkboxes in a GET form which results in a URL with a querystring like ?q=&amp;cat=&amp;city%5B%5D=28&amp;city%5B%5D=26&amp;sort=asc&amp;order=name when submitted. The Object/Array behind this string looks like:

Array
(
    [q] =&gt; 
    [cat] =&gt; 
    [city] =&gt; Array
        (
            [0] =&gt; 28
            [1] =&gt; 26
        )
    [sort] =&gt; asc
    [order] =&gt; name
)


I'm trying to create a link with one of those GET params changed, but I can't find a way to update a single value. So now I'm rebuilding the URL by creating an object based on the given query params.

If I pass this object (as shown above) to the second argument inside Craft's url() function to use this URL on a simple &lt;a&gt; tag, I get an Array to string conversion error.

I seems Craft can't handle nested arrays in this function. Is there another method to generate an URL from such an object?
Yeah, looks like Craft's url() method doesn't support nested array syntax for querystring params.

If you still want to use it, then you'd need to flatten it with unique keys such as:

Array
(
    [q] =&gt; 
    [cat] =&gt; 
    [city0] =&gt; 28
    [city1] =&gt; 26
    [sort] =&gt; asc
    [order] =&gt; name
)


Alternatively you can manually build the URL yourself in Twig in whatever format you'd like.