Hi, guys. Is there a way to merge two org.json.JSONObject using Kotlin? I’ve already googled it, but it was unsuccessfully. Maybe someone has an approach for that? Thanks in advance.
d
Dominaezzz
05/19/2020, 1:01 PM
Merge how? How do you want to handle duplicate keys?
n
Nikolay Puliaev
05/19/2020, 1:04 PM
I have predefined keys for my JSON, and they will not duplicate.
For example:
Copy code
Json1
{
"id" : "1",
"name" : "Example"
}
Json2
{
"age": "99"
}
Result Json should look like
{
"id" : "1",
"name" : "Example",
"age": "99"
}