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
cannot be parsed into any of the following kotlin clases (Example2 or Example3):
private class Example2(aSymbol: String, aType: Int) {
val symbol = aSymbol
val type = aType
}
or
class Example3(aSymbol: String, aType: Int) {
val symbol: String
val type: Int
init {
symbol = aSymbol
type = aType
}
}
while parsing into the following Example1 class will succeed:
private class Example1(val aSymbol: String, val aType: Int)
The parsing into Example2 or Example3 fail with a message like:
Unable to instantiate Example2:No argument provided for a required parameter: "parameter #0 aSymbol of fun (kotlin.String, kotlin.Int)
The parsing into Example2 or Example3 will succeed if a custom converter is configured.
If I understood correctly, Klaxon is supposed to use the primary constructor (or even secondary ones, possibly?) with their defined parameters to instantiate the required class, in this case then triggering the init logic that may be defined in field initializers or in the init block(s).
My environment:
Klaxon v5.5
Kotlin plugin v1.6.0
JVM v11
WIndows 10
Thanks for your support,
GP
The text was updated successfully, but these errors were encountered:
Hello,
A json fragment like the following:
cannot be parsed into any of the following kotlin clases (Example2 or Example3):
or
while parsing into the following Example1 class will succeed:
The parsing into Example2 or Example3 fail with a message like:
The parsing into Example2 or Example3 will succeed if a custom converter is configured.
If I understood correctly, Klaxon is supposed to use the primary constructor (or even secondary ones, possibly?) with their defined parameters to instantiate the required class, in this case then triggering the init logic that may be defined in field initializers or in the init block(s).
My environment:
Thanks for your support,
GP
The text was updated successfully, but these errors were encountered: