question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

KotlinxSerializer only supports last registered list

See original GitHub issue

KotlinxSerializer only supports the last registered list. Each time a new list is registered (i.e MyObject.serializer().list), it replaces the previously registered list.

I have a project with failing test cases here: https://github.com/keiththompson/KotlinxSerializer-Bug

Ktor Version: 1.0.0 Client: OkHttp OS: MacOS JVM:

/usr/libexec/java_home -V
Matching Java Virtual Machines (1):
1.8.0_144, x86_64:  "Java SE 8"     
/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
e5lcommented, Nov 20, 2018

Hi, @keiththompson thanks for the report. It’s a known issue. The serializers registered by the target KClass object and it is the same for all lists: List<*>. There is no class Type in kotlin-native and kotlin-js for now, so the KClass is the only one possible key.

If you have any thoughts about a possible solution you could share it with us. btw. PRs are always welcome 😃

0reactions
feresrcommented, Jan 22, 2020

This problem is not fixed: https://github.com/ktorio/ktor/issues/969

I might be wrong, leaving this here for reference

(UPDATE: it’s fixed on 1.3.0) 🎉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Content negotiation and serialization | Ktor
Serializing/deserializing the content in a specific format when sending requests and receiving responses. Ktor supports the following formats ...
Read more >
JSON Serialization in Ktor. Introduction | Nerd For Tech
util.ArrayList, you should probably use List instead of ArrayList (Moshi only supports the collection interfaces by default) or else register a ...
Read more >
Ktor: Serialize/Deserialize JSON with List as root in Multiplatform
Works only if you register only one list serializer. When there are more, KotlinxSerializer.lookupSerializerByType() doesn't distinguish between ...
Read more >
Serialization | Kotlin
You can find the complete list of supported serialization formats below. ... Check out the releases on GitHub to find the latest versions....
Read more >
Kotlin Multiplatform for iOS Developers - InfoQ
KMP is not the final step to accomplishing 100% shared code across all platforms ... Trying to minimize repetition is just good programming....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found