Skip to content

Instantly share code, notes, and snippets.

@MeNiks
Last active June 20, 2024 11:10
Show Gist options
  • Save MeNiks/597b761f3b2ea8ec511d5d40a3213399 to your computer and use it in GitHub Desktop.
Save MeNiks/597b761f3b2ea8ec511d5d40a3213399 to your computer and use it in GitHub Desktop.
Add/Update properties of kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.jsonObject
fun JsonObject.addUpdateJsoObject(updateJsonObject: JsonObject): JsonObject {
return JsonObject(
toMutableMap()
.apply {
updateJsonObject.forEach { (key, je) ->
put(key, je)
}
}
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment