Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encoding/json: support unmarshaling []int as []string with ,string tag #16784

chenjie4255 opened this issue Aug 18, 2016 · 1 comment


Copy link

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?
  2. What operating system and processor architecture are you using (go env)?
  3. What did you do?

I can marshal a int64 to json's string with a tag `json:",string"``, but it could not support a []int64 to json's string, I try the following code but it fail:

    type s struct {
        IDs []int64 `json:"ids,string"`
    data := []byte(`{"ids":["123", "222"]}`)
    var ret s

    err := json.Unmarshal(data, &ret) // err here....
  1. What did you expect to see?

a succeeful result.

  1. What did you see instead?

a marshal error.

@odeke-em odeke-em changed the title support json marshal from []int to array of string encoding/json: support unmarshaling []int as []string with ,string tag Aug 18, 2016
Copy link

Duplicate of #15624, which has been marked as a feature request. Closing in favor of the mentioned issue.

@golang golang locked and limited conversation to collaborators Aug 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet

No branches or pull requests

3 participants