Skip to content Skip to sidebar Skip to footer

How To Get Values Of An Array Of Dictionary From Alamofire Response Using Swift3

I'm trying to extract 'translations' Array 'text' and 'verses' array 'verse_key' data from below json response using Alamofire and swift3. I'm new to swift and I can't find a wa

Solution 1:

Use swiftyJSON.

 switch response.result{
    case .success(let data) :
    let json = JSON(data)
    let verses = json["verses"].Stringvalue
    print(verses)  //get all verses
    print(verses["verse_key"].Stringvalue)  // get "verse_key" 
    break

You can take each values from this json by giving the key names. If you want to get the "verses" , use json["verses"].You can also use JSONdecoder.


Post a Comment for "How To Get Values Of An Array Of Dictionary From Alamofire Response Using Swift3"