David
06/13/2019, 9:42 AM{}
or the structure that my serialiser expects e.g. {"id": "ABC123", "status": "STATUS"}
. I have tried a number of approaches that i’ve documented on this SO ticket;
https://stackoverflow.com/questions/56541201/parsing-empty-object-with-kotlinx-serialization
Would anyone be able to point out where I am going wrong?Lawik
06/13/2019, 9:48 AMencodeDefaults
:```Json(encodeDefaults = true).parse(YOUR_SERIALIZER, YOUR_STRING)```David
06/13/2019, 9:49 AMLawik
06/13/2019, 9:54 AMencodeDefaults
, only annotated the property with @Optional
Lawik
06/13/2019, 9:54 AMLawik
06/13/2019, 9:56 AM@Optional
isn't required anymore in 1.3.30?David
06/13/2019, 9:57 AM@Optional
is working as expected (error like this aren’t thrown!) …I think what is different about this one is that the API returns a 200 with this empty object which is definitely not of the shape I’ve told it the response will be since all fields on the object are gone.David
06/13/2019, 9:57 AMAre you surechecksisn’t required anymore in 1.3.30?@Optional
David
06/13/2019, 9:58 AMDavid
06/13/2019, 9:59 AMDavid
06/13/2019, 10:00 AMDavid
06/13/2019, 10:08 AMencodeDefaults=true
, no dice.sandwwraith
06/13/2019, 10:25 AMencodeDefaults
affects serialization, not deserializationsandwwraith
06/13/2019, 10:27 AMJson.nonstrict.parse(GeoCoordinate.serializer(), """{}""")
works well for me. You can submit an issue with an attached sample project to reproduce, if you're sure that this is not a problem with some old Kotlin version stuck somewhere in dependenciesDavid
06/13/2019, 10:40 AMgradlew dependecies
!Nikky
06/13/2019, 10:47 AMDavid
06/13/2019, 10:53 AMkotlinCompilerClasspath
\--- org.jetbrains.kotlin:kotlin-compiler-embeddable:1.3.21
+--- org.jetbrains.kotlin:kotlin-stdlib:1.3.21
| +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.21
| \--- org.jetbrains:annotations:13.0
+--- org.jetbrains.kotlin:kotlin-script-runtime:1.3.21
+--- org.jetbrains.kotlin:kotlin-reflect:1.3.21
| \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.21 (*)
\--- org.jetbrains.intellij.deps:trove4j:1.0.20181211
kotlinCompilerPluginClasspath
+--- org.jetbrains.kotlin:kotlin-serialization:1.3.21
+--- org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:1.3.21
\--- org.jetbrains.kotlin:kotlin-sam-with-receiver:1.3.21
David
06/13/2019, 10:55 AMcompileOnly
and compiler*
configurations are stuck somehow with 1.3.21David
06/13/2019, 10:55 AMDavid
06/17/2019, 8:59 AM