[Feature]: Add map support to QueryParser
Author: scott97Created Jun 28, 2023Updated Sep 29, 2026
Labels✏️ Feature
Feature Description
It would be handy to be able to use fields with type map[string] with gofiber's QueryParser for queries where we don't know an exhaustive list of valid values.
Additional Context (optional)
No response
Code Snippet (optional)
// An example of using go's maps for filtering products from an API.
// A map is more useful than a struct here because it does not have to provide an exhaustive list of all valid queries.
type Product struct {
PriceMin int `query:"price_min"`
PriceMax int `query:"price_max"`
Attributes map[string]string `query:"attributes"`
}
app.Get("/", func(c *fiber.Ctx) error {
p := new(Product)
if err := c.QueryParser(p); err != nil {
return err
}
})
// http://localhost:3000/?price_min=1&price_max=1000&attributes[colour]=red&attributes[screensize]=1000x500Checklist:
- I agree to follow Fiber's Code of Conduct.
- I have checked for existing issues that describe my suggestion prior to opening this one.
- I understand that improperly formatted feature requests may be closed without explanation.
Source: gofiber/fiber