Deserializing json with PolymorphicJsonAdapterFactory and Retrofit #1632
Unanswered
niclashalvorsen
asked this question in
Q&A
Replies: 2 comments
|
BTW this works when creating an adapter, but not when setting it as a part of Retrofit with addConverterFactory()
|
0 replies
|
Any solution on this issue. I am also facing the same and haven't been able to find any solution. The debugger shows that CustomAdapter is attached to the Moshi but it never gets called to serialize the sealed class. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I have read about every blog and documentation there is about Moshi's PolymorphicJsonAdapterFactory but i cannot make it work for some reason.
Retrofit API & DTO's:
Moshi & Retrofit setup:
My dependencies:
I have tried making the super class open, sealed class and interface.
Sealed:
Interface:
Open:
Dosent crash, but i'm just getting a Payment object without a parent.
I have tried to add
@JsonClass(generateAdapter = true)on the data classes (and the parent) but it makes no difference.I have also tried older versions of Moshi, but dosent seem to work for me there either.
What am i missing here?
All reactions