https://kotlinlang.org logo
Title
c

cafonsomota

08/03/2022, 4:57 PM
hello all! I’ve noticed something quite odd in a request client side. I’m using ktor in a multiplatform project (android/ios) and I’m sending an object with latitude/longitude (defined as double). If their value is 0.0, they’re not sent, if it’s a different value it is. Anything I might be doing wrong?
c

Casey Brooks

08/03/2022, 5:07 PM
If you’re using #serialization json and those properties are the class’s default values, they won’t get encoded by default. But you can set
encodeDefaults = true
in the Json config to force them to be included
c

cafonsomota

08/04/2022, 1:30 PM
it was! didn’t noticed that!; thank you 🙂