golang/go
Vedi su GitHubencoding/json: interface{} not being stringified when JSON ",string" tag is used
Open
#32.055 aperta il 15 mag 2019
NeedsInvestigationhelp wanted
Metriche repository
- Star
- (133.883 star)
- Metriche merge PR
- (Nessuna PR mergiata in 30 g)
Descrizione
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.