How can convert an array of jsons to a json object?

160 Views Asked by At

I did some changes to an specific part of a json, an array to be more specific, to finish I want to save the changes in the json, but I can't because xcode give me this error:

"Cannot assign value of type '[JSON]' to type 'JSON'"

This is a sample of the code:

let originalSessionJson = dataObject!.sessionJson
var json:[JSON] = originalSessionJson["activity"].arrayValue

for i in 0 ..< json.count{
 .
 .
 .
}
dataObject?.sessionJson["activity"] = json

Thanks for the help.

1

There are 1 best solutions below

1
On

Perhaps you mean this:

dataObject?.sessionJson["activity"].arrayObject = json