google / google/go-querystring
Adding support to encoding of nested struct arrays
- Dominant language
- Go
- Stars
- 2.1k
- Forks
- 188
- Avg merge
- 10h 23m
- Merged PRs (30d)
- 1
Description
I plan to fix the issue described below for encoding nested struct arrays.
Currently this structure
``` go
type Nested struct {
A string `url:"theA,omitempty"`
B string `url:"theB,omitempty"`
}
type NestedArr []Nested
na := struct {
A NestedArr `url:"arr"`
B Nested `url:"nested"`
}{
A: NestedArr{Nested{
A: "aa",
B: "bb",
}, Nested{
A: "aaa",
B: "bbb"}},
B: Nested{
A: "zz",
B: "xx",
},
}
```
encode to
``` javascript
arr={aa bb}&arr={aaa bbb}&nested[theA]=zz&nested[theB]=xx
```
To be consistent with the Ruby style parsing the result should look like this
``` javascript
arr[0][theA]=aa&arr[0][theB]=bb&arr[1][theA]=aaa&arr[1][theB]=bbb&nested[theA]=zz&nested[theB]=xx
```
Contributor guide
Assessment
This issue has not been assessed yet.