Open vetalalien opened 3 months ago
Hi!
The whole idea of the lib was to deserialize to as specific type as possible. The lib treats numbers as primitive and primitives are not objects in java, hence they can not be cast to an Object reference.
On Wed, 7 Aug 2024, 19:08 vetalalien, @.***> wrote:
Hi, there!
I attempted to use in Kotlin the jddl deserializer with these json and class for deserialization:
The json is:
{ "dummy": 123 }
The class is:
class DeserializedItemObject { val dummy: Any? = null }
The line related to deserialing start is here: val obj: DeserializedItemObject = deserializer.deserialize(json, DeserializedItemObject::class.java)
This way I suppose, that dummy can be whatever type - integer, string, boolean, ..., some another user specific type
But I got the next error after running the code: "Caused by: com.pretius.jddl.JddlCanNotDeseializeNumberException: Unsupported expected class=[class java.lang.Object] for number deserializer".
Help me, please, to figure out what's wrong (maybe I'm misusing the library somehow...). Thanks much in advance!
— Reply to this email directly, view it on GitHub https://github.com/Pretius/pretius-jddl/issues/3, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACEW3H3NXIWIXSB3FF65SE3ZQJH7TAVCNFSM6AAAAABME2KZV6VHI2DSMVQWIX3LMV43ASLTON2WKOZSGQ2TGOJUG44TGNA . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Hi, there!
I attempted to use in Kotlin the jddl deserializer with these json and class for deserialization:
The json is:
The class is:
The line related to deserialing start is here:
val obj: DeserializedItemObject = deserializer.deserialize(json, DeserializedItemObject::class.java)
This way I suppose, that dummy can be whatever json simple types - integer, string, boolean etc.
But I got the next error after running the code: "Caused by: com.pretius.jddl.JddlCanNotDeseializeNumberException: Unsupported expected class=[class java.lang.Object] for number deserializer".
Help me, please, to figure out what's wrong. Maybe I should use some specific rule provided by the library, or, perhaps, I'm misusing the library somehow?
Thanks much in advance!