Skip to content

Add field name normalization #66

Open
@ivanjaros

Description

@ivanjaros

Package version eg. v9, v10:

v4

Issue, Question or Enhancement:

The url query can have fields like foo[bar]=baz, foo[0]=baz, foo[0]bar[0]baz=car and so on. The thing is that foo[0] and foo[bar] are distinctively different types - obviously a map/struct and array/slice. Because this library requires dot as delimiter, I have to replace foo[bar] with foo.bar otherwise it will not work for nested structs. I can use simple replacer strings.NewReplacer("][", ".", "[", ".", "]", "") but the problem is that it will screw up arrays by changing foo[0] into foo.0 which is incorrect. So it would be nice to have a built-in function that handles this appropriately and returns altered map(url query) or directly consumes values and handles the key massaging internally.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions