Ofir Bar
02/19/2020, 12:40 PMProfession
that we send to our backend using Retrofit.
data class Profession (
@SerializedName("activeSince") var activeSince : Long?,
@SerializedName("name") var businessName : String?,
@SerializedName("description") var businessDescription : String?,
@SerializedName("licenseImageUrl") var licenseImageUrl : String?
)
Sometimes we send the entire object, but other times, I prefer to only send specific fields (for example, only the businessDescription
and businessName
).
Is it possible to tell retrofit to not include the other 2 fields in the network request? (activeSince
and licenseImageUrl
).
Note: I can’t send activeSince
and licenseImageUrl
as null. Our backend will send me back errors if I attempt to do that (edited)Oscar Sequeiros
02/19/2020, 12:48 PMOfir Bar
02/19/2020, 1:05 PMdino9
02/19/2020, 1:07 PM@SerializedName("activeSince") var activeSince : Long? = null,
@SerializedName("licenseImageUrl") var licenseImageUrl : String? = null,
Can you try set null
?Ofir Bar
02/19/2020, 1:31 PMAndi Beqiri
02/19/2020, 1:33 PMJavier Troconis
02/19/2020, 2:37 PMOfir Bar
02/19/2020, 2:41 PMJavier Troconis
02/19/2020, 2:45 PMserializeNulls()
on the buildertoban
02/19/2020, 3:54 PMencodeDefaults = false
in your JsonCofiguration.Ofir Bar
02/19/2020, 4:06 PM