Closed ningcng closed 1 year ago
JSON doesn't really distinguish between integers and floats. That's why we only support double. But I agree with you that it would be preferable to encode 1 as 1 and not as 1.0.
I have tested this in C++, Go and Python, and all of them encode 1 as "1", and not as "1.0". So we really should do the same in Java as well.
I think it would be best to simply overload "addNumberClaim" with a function that takes a long as argument. I tried it out and that works as expected. Would that resolve your issue?
This has now been added here:
https://github.com/tink-crypto/tink-java/commit/5f78d9a1118749cd9b42adcbc7c7e22a5890d69b
Is your feature request related to a problem? Yes
I want to add an integer claim 1, not a double claim 1.0. So RawJwt.addNumberclaim is not good.
What sort of feature would you like to see? RawJwt.addIntegerClaim()
Have you considered any alternative solutions? RawJwt.addJsonClaim()
Using RawJwt.addJsonClaim() to add an integer is clumsy.