Skip to content

Conversation

elliotcourant
Copy link

If you unmarshall a json object using the json.Decoder and the UseNumber function, it will create numbers on the map as a json.Number object. This object has helper functions for handling ints and floats. So if a json.Number is encountered, try to handle the type of the number based on the destination.

This partially addresses #138 even though it is an old issue.

If this is not something you'd like to have built in that's totally fine, I'm happy to fork or try to build a transformer for this. But figured a PR would be best since others have asked for it in a way and this seemed like a correct way to do it.

If you unmarshall a json object using the json.Decoder and the UseNumber
function, it will create numbers on the map as a `json.Number` object.
This object has helper functions for handling ints and floats. So if a
json.Number is encountered, try to handle the type of the number based
on the destination.
@darccio
Copy link
Owner

darccio commented May 5, 2025

Thanks @elliotcourant. I'll give it a thought.

@elliotcourant
Copy link
Author

Thank you I really appreciate it!

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 this pull request may close these issues.

2 participants