Hello guys,
my JSON is supposed to look like this.
I am using import org.json.JSONObject
{"zip":123, "people":[{"firstname":"Thomas", "lastname":"Tatum"},
{"firstname":"Drew", "lastname":"Uncle"}]}
I have a MutableList
, in the List are Person
(it’s a data class
with firstname and lastname).
But I don’t know how to get my list items in a JSONObject/Array to fit in json
(see below).
val json = JSONObject(
mapOf(
"zip" to 123,
"people" to //I don't know how to get my values here
)
)
Maybe someone can help me.