I have a json array with the following structure
{
"connection": {
"established": "yes"
},
"ping": {
"server": "thirteen"
}
}
also i have a simple array of server names called servers
my goal is to append the values from the servers array to the Jsonarray - copying the "connection", "established", "yes", "ping", "server" values and just modifying the "thirteen" value.
So that the end result would look something like this
{
"connection": {
"established": "yes"
},
"ping": {
"server": "fourteen"
}
},
{
"connection": {
"established": "yes"
},
"ping": {
"server": "fifteen"
}
}
e.t.c.
I tried implementing the SwiftyJSON array library, but didn't really understand how to append values to the json itself.
Is there a way to manage it?
Appreciate any insights!
[]Array, convert the JSON string to dictionary withSwiftyJSON, and append the dictionary to the array.