SwiftyJSON looping through an array of JSON objects

gwhiz picture gwhiz · Apr 20, 2015 · Viewed 13.2k times · Source
[
    {
        "cont": 9714494770,
        "id": "1",
        "name": "Kakkad"
    },
    {
        "cont": 9714494770,
        "id": "2",
        "name": "Ashish"
    }
]

The one above is a json array filled with JSON objects. I don't know how to parse through this with SwiftyJSON

Answer

Eric Aya picture Eric Aya · Apr 20, 2015

Example from the SwiftyJSON page, adapted to your data:

let json = JSON(data: dataFromNetworking)
for (index, object) in json {
    let name = object["name"].stringValue
    println(name)
}