You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Jwt parse = Jwts.parserBuilder()
.setSigningKey(getKey())
.build()
.parse(token);
Claims body = (Claims) parse.getBody();
// will throw exception
Long id = body.get("id", Long.class));
like this
io.jsonwebtoken.RequiredTypeException: Cannot convert existing claim value of type 'class java.lang.Double' to desired type 'class java.lang.Long'. JJWT only converts simple String, Date, Long, Integer, Short and Byte types automatically. Anything more complex is expected to be already converted to your desired type by the JSON Deserializer implementation. You may specify a custom Deserializer for a JwtParser with the desired conversion configuration via the JwtParserBuilder.deserializeJsonWith() method.
I store the id is class is Long,the value is 100.0, I looked at the source code,if not type of Integer will not came in the if.
The text was updated successfully, but these errors were encountered:
I am used
like this
io.jsonwebtoken.RequiredTypeException: Cannot convert existing claim value of type 'class java.lang.Double' to desired type 'class java.lang.Long'. JJWT only converts simple String, Date, Long, Integer, Short and Byte types automatically. Anything more complex is expected to be already converted to your desired type by the JSON Deserializer implementation. You may specify a custom Deserializer for a JwtParser with the desired conversion configuration via the JwtParserBuilder.deserializeJsonWith() method.
I store the id is class is Long,the value is 100.0, I looked at the source code,if not type of Integer will not came in the if.
The text was updated successfully, but these errors were encountered: