Hey guys, Is it possible to tell retrofit to ignor...
# squarelibraries
o
Hey guys, Is it possible to tell retrofit to ignore certain fields of an object when sending the object over the network? We have a request object
Profession
that we send to our backend using Retrofit.
Copy code
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