A Go library for decoding url.Values into Go values and encoding Go values into url.Values with full map and array support.
Form is a Go library that decodes HTTP form data (url.Values) into Go structs, maps, slices, and other types, and encodes Go values back into url.Values. It solves the problem of manually parsing form submissions and generating query strings by providing a robust, type-safe conversion layer. It handles complex nested structures, custom types, and various array formats out of the box.
Go developers building web applications or APIs that need to process HTML form submissions, parse query parameters, or generate URL-encoded data. It's particularly useful for those working with complex data structures in HTTP handlers.
Developers choose Form for its comprehensive type support, flexibility with arrays and maps, and performance. Unlike standard Go form parsing, it handles nested structures, custom type registration, and precise slice/array indexing without manual intervention.
:steam_locomotive: Decodes url.Values into Go value(s) and Encodes Go value(s) into url.Values. Dual Array and Full map support.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Handles both numbered arrays (e.g., 'Array[0]') and normal arrays with multiple values, providing flexibility in form data formatting without rigid indexing requirements.
Honors specified indices in slices and arrays, expanding dynamically as needed, which prevents errors with sparse data and allows precise control over data placement.
Supports a wide range of Go types including structs, maps, slices, and primitives, with nesting ad infinitum, making it suitable for complex form structures.
Allows overriding default type handling, such as changing time formats from RFC3339, enabling easy adaptation to specific project requirements.
Explicitly does not support encoding.TextUnmarshaler, as admitted in the README, limiting compatibility with custom types that use this standard interface for parsing.
Only handles url.Values, so it cannot parse JSON, XML, or other data formats common in modern APIs, requiring separate libraries for mixed data handling.
Introduces a third-party library where simpler, flat forms might be adequately handled by Go's standard library alone, adding unnecessary complexity for basic use cases.