This is my json for parsing (example):
[ { "id": 1, "name": "Team name", "shower": { "id": 1, "status": 1, "startLocation": { "id": 1, "name": "abc 16" } } }, { "id": 2, "name": "Team name", "shower": { "id": 2, "status": 1, "startLocation": { "id": 1, "name": "efg 16" } } } ]
as you can see, this is an array of (commands). I need to get every team and do something with it.
After many attempts, I tried using SwiftyJSON , because I thought it would be easier. But that did not work for me.
This is what I tried:
let array = JSON(response) // print each subJSON in array for team in array.arrayValue { print(team) }
But the loop is not working. He does not enter the loop at all. Maybe he does not understand that my json is an array.
I see an array object in the debugger. It looks like this:

How can I get these sub-JSON?
Thanks.
json ios swift swifty-json
Eyal ben yehuda
source share