In Java, we can add/remove property in JSONObject....
# serialization
l
In Java, we can add/remove property in JSONObject. In serialization, JsonObject is Map that can not be change. Is any suggestion to migrate this logic?
n
.toMutableMap()
You can create a new json object from a map
JsonObject(map)
I actually just append keys and create a new object from that
try
Copy code
fun JsonObject.put(key: String, value: Long): JsonObject {
    return JsonObject(this + (key to JsonPrimitive(value)))
}
l
but it seems have overhead, maybe i should give up extension function