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

Support json.Number type #292

Closed
c625473164 opened this issue Jun 11, 2021 · 0 comments · Fixed by #364
Closed

Support json.Number type #292

c625473164 opened this issue Jun 11, 2021 · 0 comments · Fixed by #364

Comments

@c625473164
Copy link

I want to covert my json encoded data to msgp data, Then I have to Unmarshal the bytes to a map[string]interface{}, and marshal it to msgp.
but the data from json Unmarshal do not support json.Number type when I marshal it.
I have to use json.Number because there are some big int64 numbers in the original bytes.

klauspost added a commit to klauspost/msgp that referenced this issue Sep 28, 2024
Allow encoding and decoding of `json.Number` values, either as struct members or as interface members.

Numbers will be encoded as integer, if possible, otherwise float64 is used. To cover the zero values, write an empty string, but invalid values will return errors when encoded

It is possible to encode as string with `//msgp:replace json.Number with:string`.

Fixes tinylib#292
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant