-
Notifications
You must be signed in to change notification settings - Fork 191
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
Deserializing BigInt with serde_json #250
Comments
The provided serialization of I think |
Thank you so much for your quick response @cuviper :). The JSONs I am working with at the moment do contain large integer literals and I am not able to change this format. If they were strings this could be easily solved parsing as you mentioned, but it is not the case. I think I will have to find another solution. Anyway, thanks again! |
FWIW, here's an example parsing via If I change that input to a very large integer, it looks like |
Hi @cuviper! an @entropidelic coworker here. Adding this feature to the following code deserializes the number without losing precision
|
Great! That doesn't need any changes in Maybe we could provide a similar serde helper though, which does something like what |
I didn't make any changes in |
I looked into that, but |
Hi guys, I am using
serde_json
to deserialize a JSON file into a struct,MyStruct
The JSON file looks like this,
and I want the value asociated with the
"num"
key to be deserialized as aBigInt
. I am using the serde feature of the crate.When I run this program, it panics with the following error
I assume that the deserializer is expecting a tuple with the sign and the magnitude of the number? Is this the expected behaviour? How should I make this work?
Thank you very much in advance
The text was updated successfully, but these errors were encountered: