I'm trying to build a complicated JSON object. But...
# serialization
j
I'm trying to build a complicated JSON object. But the
JsonObjectBuilder
doesn't have any
suspend
functions. What would then be the recomended way of building a JSON object across multiple coroutines?
p
Write extension inline functions which take a lambda
👍 1
j
JsonObjectBuilder
only has an internal constructor.
z
Collect all your values first (in some data structure, eg a map or some data classes), and then create the json object from that once all the data is ready.
👍 1