go-querystring icon indicating copy to clipboard operation
go-querystring copied to clipboard

Add support for JSON encoding a struct field

Open schmorrison opened this issue 4 years ago • 0 comments

Will be submitting a PR to add support for JSON encoding a nested struct field.

A specific API endpoint I am working on requires a URL encoded form but one of the form fields is JSON. The PR will add an option that will encode the field as a JSON string.

For example:

type A struct {
    V string `json:"v"`
}

type B struct {
    A A `url:"a,json"`
}

// url.Values{
//     "a": {`{"v": "abc"}`}
// }

Thanks and best regards,

schmorrison

schmorrison avatar Jul 25 '21 18:07 schmorrison