Hi everyone, simple question: I have a JsonObject...
# serialization
t
Hi everyone, simple question: I have a JsonObject:
Copy code
val jsonObject = jsonElement.jsonObject
How do I add a new entry to the object? (something like this:)
Copy code
jsonObject.addProperty(name, value)
(name and value are both Strings)
p
JsonObject
are immutable; there's no great solution (see this thread): https://kotlinlang.slack.com/archives/C7A1U5PTM/p1607458147418900
t
I'm completely in favor of immutability, your update extension function will do nicely, thanks!
👍 1