Part of my API Request resembles this data model, which I have populated with default values
@Serializable
data class RequestOptionalInput(
@SerialName("USER_AGENT")
val userAgent: String = "",
@SerialName("WEB_SERVER")
val webServer: String = "",
@SerialName("REFERRER")
val referrer: String = "0.0.0.0",
@SerialName("ROUTE")
val route: String = "/",
@SerialName("ANALYTICS_ID")
val analyticsId: String = "",
@SerialName("DOMAIN_TOKEN")
val domainToken: String = "",
@SerialName("DOMAIN_NAME")
val domainName: String = ""
)
However when I perform
json.encodeToString(request)
on the entire request object all my default values are completly missing, the only way I can get the "default" values to appear is to "manually" set them in the constructor.
Is there any approach I can use that will allo wme to use the default values? instaed of having to always code them passed in the data class constructor?