Tower Guidev2
09/01/2021, 9:44 AMTower Guidev2
09/01/2021, 9:47 AM@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?haris mehmood
09/01/2021, 10:26 AMephemient
09/01/2021, 10:28 AMval json = Json { encodeDefaults = true }
ephemient
09/01/2021, 10:29 AMTower Guidev2
09/01/2021, 10:34 AM