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?
to your account
$ go version
go version go1.14.1 windows/amd64
$ go env
The text was updated successfully, but these errors were encountered:
This is on purpose and documented; see #28827.
Sorry, something went wrong.
Here's the order, as per the docs:
- keys of any string type are used directly
- encoding.TextMarshalers are marshaled
- integer keys are converted to strings
To force json to use your marshaler, don't let your type be a string type: https://play.golang.org/p/xMmVspIdMMS
You could argue the first two options should be reversed in the order, but I don't think we can change the documented behavior at this point without breaking a good portion of users.
No branches or pull requests