15:49:01: [ERROR] java.lang.ClassCastException: class java.lang.Long cannot be cast to class java.lang.Integer (java.lang.Long and java.lang.Integer are in module java.base of loader 'bootstrap') java json code example

Example: class java.lang.Integer cannot be cast to class java.lang.Long (java.lang.Integer and java.lang.Long are in module java.base of loader 'bootstrap')

// on my case, instead of casting I did:

Long variable = Long.valueOf(variable.get("Attribute").toString());

Tags:

Java Example