charleskorn
01/31/2019, 9:29 AMghedeon
01/31/2019, 1:35 PM@Serializable
data class Foo(@Transient val bar: String)
println(Json.stringify(Foo.serializer(), Foo("lorem")))
Do I miss anything about @Transient
?Narek Mailian
01/31/2019, 3:07 PMNarek Mailian
02/01/2019, 12:21 PMT
instead of Data
? fun deserialize(string: String): Data {
return Json.nonstrict.parse(Data.serializer(), string)
}
josephivie
02/01/2019, 10:35 PMmax.cruz
02/01/2019, 10:52 PM> Task :common:compileKotlinIos
error: compilation failed: Can’t locate polymorphic serializer definition
(gradle 4.10.3, kotlin 1.3.20, kotlinx-serialization-runtime-native 0.9.1)
There is some workaround or suggestion to fix this issue?ghedeon
02/01/2019, 10:56 PM@Serializable(with = FooSerializer::class)
val names: List<Foo>
Works only if I define FooSerializer: KSerializer<List<Foo>>
. I'm wondering if I can define only FooSerializer: KSerializer<Foo>
and let the kotlin to deal with collections.ghedeon
02/02/2019, 10:56 AM@ContextualSerialization
on a file
2. @Serializable(with =)
on a field
3. Json.install()
is the same? It's 3 different ways of runtime resolution?galex
02/06/2019, 5:08 AMTypeError: tmp$.serializer is not a function at compiledSerializer (<http://localhost:9000/bundle.js:44171:87>) at serializer (<http://localhost:9000/bundle.js:36889:22>) at KotlinxSerializer.lookupSerializerByType_0 (<http://localhost:9000/bundle.js:54654:64>) at Coroutine$read_ro165m$.doResume (<http://localhost:9000/bundle.js:54591:40>) at KotlinxSerializer.read_ro165m$ (<http://localhost:9000/bundle.js:54621:21>) at Coroutine$JsonFeature$Feature$install$lambda_0.doResume (<http://localhost:9000/bundle.js:54456:63>) at <http://localhost:9000/bundle.js:54488:21> at SuspendFunctionGun.loop_0 (<http://localhost:9000/bundle.js:62922:16>) at <http://localhost:9000/bundle.js:62879:31> at SuspendFunctionGun.proceed (<http://localhost:9000/bundle.js:62887:49>)
message: "tmp$.serializer is not a function"
Any idea?
-> Seems like the problem comes from generics? I’ve just tried sending a simple model as response and this worked. So what’s the deal with generics?jw
02/08/2019, 3:02 PMtoString()
and have a static parser of that representationNikky
02/11/2019, 7:26 AMencodeDefaults = false
in Json
constructor callbartvh
02/13/2019, 12:46 PM(..).set
in an annotiation.
@Serializable
data class SessionState(
@Serializable(with = InstantSerializer::class)
val start: Instant,
val ips: Set<InetAddress>?
)
Akash Agarwal
02/21/2019, 5:52 PMspand
02/25/2019, 1:29 PM@Serializable
class Response(
val localDate: LocalDate
)
@Serializable(with = LocalDateSerializer::class)
expect class LocalDate
@Serializer(LocalDate::class)
expect object LocalDateSerializer : KSerializer<LocalDate>
But it complains that no Serializer for element of type LocalDate has been found. Am I doing something wrong ?apomelov
02/28/2019, 5:45 AMstanislav
02/28/2019, 8:53 AMerror: compilation failed: Can't locate polymorphic serializer definition
Paulius Ruminas
03/05/2019, 2:14 PMsealed class Error {
@Serializable
data class Fatal(val message: String) : Error()
@Serializable
object Unauthorized: Error()
@Serializable
object Forbidden: Error()
}
It does not throw an error but it is not the same object if i deserialize it multiple times.josephivie
03/06/2019, 6:22 PMserialize
and deserialize
functions. Note that you do need to write your own descriptor that further defines the fields for type
and data
.Patrick Jackson
03/12/2019, 4:19 PMMarc Knaup
03/12/2019, 9:11 PMStrict JSON encountered unknown key: title\nYou can disable strict mode to skip unknown keys
. That's not very helpful for the developer implementing the API client because they don't know the full JSON path and/or location where the problem has occurred. Also it communicates implementation-specific information in the message which you don't want to report to clients.
More useful would be something like Unexpected property 'title' in 'request.posts[0].author' at offset 123
.Marc Knaup
03/12/2019, 9:27 PMIllegalStateException: -3 is not among valid MyEnum choices, choices size is 7
Marc Knaup
03/12/2019, 9:29 PMribesg
03/13/2019, 4:08 PMnull
value anywhere?hallvard
03/14/2019, 10:00 AMribesg
03/14/2019, 10:23 AMhits
array containing the results of the query. Depending on the index the query was run on, the model of these results change.
How do I implement that with kotlinx.serialization
?
- Can I use generics?
- Can I use inheritance, with one subclass per model?
- Can I say that these results should stay “raw”, like JsonObject or String, and deserialize them later to the correct model?JoakimForslund
03/22/2019, 2:43 PMThomas
03/25/2019, 8:25 PMPaul Woitaschek
03/26/2019, 9:24 AMCasey Brooks
03/26/2019, 4:14 PMNikky
03/26/2019, 6:07 PM"identifier": "fabric:min",
"value": 10
"identifier": "fabric:enum",
"value": ["A", "B", "C"]
Nikky
03/26/2019, 6:07 PM"identifier": "fabric:min",
"value": 10
"identifier": "fabric:enum",
"value": ["A", "B", "C"]
rrader
03/27/2019, 7:53 AM