form
form copied to clipboard
Serialize composite []string with empty square brackets
👋🏻 I have an API that expects data to be sent like so:
services[]=A&services[]=B
How can I achieve this?
Currently the default behaviour appears to number each element within the slice.
I see there's a DelimitWith method but that doesn't quite achieve what I need (e.g. DelimitWith('|')):
services|0=A&services|1=B
Is there a custom unmarshal method I can define that might help encode the data how I need it?
Thanks!
just use https://github.com/google/go-querystring
That's exactly what I ended up doing 🙂