golang/go
View on GitHubencoding/json: interface{} not being stringified when JSON ",string" tag is used
Open
#32,055 opened on May 15, 2019
NeedsInvestigationhelp wanted
Repository metrics
- Stars
- (133,883 stars)
- PR merge metrics
- (No merged PRs in 30d)
Description
What version of Go are you using (go version)?
1.12.5 playground
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (go env)?
NACL
What did you do?
https://play.golang.org/p/Q4JdghzkBI-
What did you expect to see?
interface{} fields that point to integers should be converted to strings when the string tag is used.
The documentation says:
It applies only to fields of string, floating point, integer, or boolean types
but it also says:
Interface values encode as the value contained in the interface. A nil interface value encodes as the null JSON value.
What did you see instead?
They were not converted to strings.