What should my data class be so that when I convert it to json using moshi it would come out like this?
{"id":"abcdef""formValues":{}}
At the moment my class looks like this.
@JsonClass(generateAdapter = true)
class MyDataClass(
@Json(name = "id")
val id: String
) {
@Json(name = "formValues")
val formValues = FormValues()
@JsonClass(generateAdapter = true)
class FormValues
}
But you see the statement
Moshi.Builder().build().adapter(MyDataClass::class.java).toJson(MyDataClass("abcdef"))
produces this
{"id": "abcdef"}
and I want this
{"id":"abcdef""formValues":{}}