Ilya Goncharov [JB]
03/27/2019, 12:37 PMExpected class kotlinx.serialization.json.JsonArray but found class kotlinx.serialization.json.JsonNull
is thrown.
Is it possible to ignore that null value in json?Nikky
03/27/2019, 5:34 PMMap<String, List<Field>>
, Field
is a custom type
the error says just > Invalid JSON at 4617: Expected '}'
the index seems to match up with the end of the file and the json seems correct to me
is there any known problems with nesting lists in maps ?ribesg
03/28/2019, 9:43 AMRainer Schlonvoigt
03/29/2019, 9:01 AM{"mandatory":3}
insteadPaulius Ruminas
04/03/2019, 7:28 AMCan't locate argument-less serializer for class kotlinx.serialization.json.JsonObject. For generic classes, such as lists, please provide serializer explicitly.
@Serializable
class Foo {
@Serializer(forClass = Foo::class)
companion object : KSerializer<Foo> {
override fun serialize(encoder: Encoder, obj: Foo) {
encoder.encode(JsonObject::class.serializer(), JsonObject(mapOf("foo" to JsonLiteral("bar"))))
}
override fun deserialize(decoder: Decoder): Foo {
TODO()
}
}
}
fun main() {
Json.stringify(Foo.serializer(), Foo())
}
ivan.savytskyi
04/03/2019, 4:23 PMkotlinx-serialization
plugin, as it can’t .serializer()
generated function to be resolved? Or there is some conf I missing?ribesg
04/04/2019, 8:23 AMkrtko
04/06/2019, 6:05 AMkrtko
04/11/2019, 5:23 AMthevery
04/12/2019, 7:16 AMPaulius Ruminas
04/12/2019, 11:25 AM0.10.1
. After update to Kotlin 1.3.30
from 1.3.21
I get this error:
e: java.lang.IllegalStateException: Backend Internal error: Exception during code generation
Cause: org.jetbrains.kotlin.codegen.ErasedInlineClassBodyCodegen cannot be cast to org.jetbrains.kotlin.codegen.ImplementationBodyCodegen
It's caused by:
@Serializable(with = TaskIdSerializer::class)
inline class TaskId(val value: Guid)
@Serializer(forClass = TaskId::class)
object TaskIdSerializer : KSerializer<TaskId> {
override fun serialize(encoder: Encoder, obj: TaskId) = encoder.encodeString(obj.value)
override fun deserialize(decoder: Decoder): TaskId = TaskId(decoder.decodeString())
}
Is there a repository with an eap version that I could try?jw
04/12/2019, 3:30 PMdrofwarcs
04/12/2019, 3:46 PM> Task :common:linkDebugFrameworkIos
e: Compilation failed: org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl@6c61d6d9 not in vtable of org.jetbrains.kotlin.ir.declarations.impl.IrClassImpl@641449e4
.......
.......
* Compiler version info: Konan: 1.2 / Kotlin: 1.3.30
* Output kind: FRAMEWORK
.......
Anything I can do to get around this issue?fkrauthan
04/12/2019, 11:01 PMPolymorphic serialization is now available for JS and Native
does still not mean that we can serialize a data class to a native JSON object for kotlin JS? (https://github.com/Kotlin/kotlinx.serialization/issues/116)Robert Jaros
04/13/2019, 11:53 AMkotlinx-serialization-runtime-js.js
file for Kotlin/JS is "resistant" to the DCE plugin, even if serialization is not used. It is reduced by DCE from 420KB to 165KB. The old one (0.10.0) is reduced from 374KB to 10KB in the same configuration. This has impact on the size of the output files for Kotlin/JS apps, if the kotlinx.serialization library is present in the sub dependencies, but no serialization features are used. Any idea what is the cause of this behavior? Any chance it can be fixed?Riccardo Montagnin
04/15/2019, 9:29 AMturansky
04/15/2019, 9:50 AMAntanas A.
04/16/2019, 12:18 PMRiccardo Montagnin
04/17/2019, 12:13 PMMap<String, Any>
?Steven
04/17/2019, 6:28 PMAntanas A.
04/18/2019, 8:03 AMSerializable
annotation at runtime? Maybe kotlin serializer stores this information in some hash map which can be accessed?
I want find an appropriate serializer by knowing only full class name, or this can be done using reflection only?ribesg
04/19/2019, 10:19 AMpardom
04/23/2019, 8:35 PMsetListMapper(Long::class, Long.serializer())
Konstantin Tskhovrebov
04/24/2019, 4:25 PMRainer Schlonvoigt
04/26/2019, 11:12 AMhudsonb
04/26/2019, 7:53 PMpajatopmr
04/29/2019, 6:48 PMthana
04/30/2019, 2:14 PMcom.soywiz.klock.Year
but doing so breakd code generation... Thats my serializer:
class YearSerializer : KSerializer<Year> {
override val descriptor: SerialDescriptor =
StringDescriptor.withName("Klock-Year")
override fun serialize(encoder: Encoder, obj: Year) {
encoder.encodeInt(obj.year)
}
override fun deserialize(decoder: Decoder): Year {
return Year(decoder.decodeInt())
}
}
And thats how i use it (Month is an enum class i wrote):
@Serializable
data class LocalDate(val dayOfMonth: Int,
val month: Month, @Serializable(with = YearSerializer::class) val year: Year) {
init {
require(month.isDayOfMonthValid(dayOfMonth, year))
}
}
ribesg
05/03/2019, 2:00 PMcommonTest
which refers to a class in commonMain
which is serializable:
ClassNotFoundException: kotlinx.serialization.KSerializer
What do?themishkun
05/06/2019, 9:23 AMmessage Video {
map<string,string> previews = 5;
// ...
}
I want to deserialize it in the such data class
@Serializable
class Video(
val thumbUrl: String
)
where thumbUrl === previews[“thumb”], any tips how to achieve that with kotlinx.serialization?themishkun
05/06/2019, 9:23 AMmessage Video {
map<string,string> previews = 5;
// ...
}
I want to deserialize it in the such data class
@Serializable
class Video(
val thumbUrl: String
)
where thumbUrl === previews[“thumb”], any tips how to achieve that with kotlinx.serialization?previews
a private property and exposed thumbUrl
as calculated one