How to parse Array of JSON to array in Swift

后端 未结 5 680
南方客
南方客 2020-12-05 12:02

I\'m trying to parse JSON which is like below

[
  {
    "People": [
      "Jack",
      "Jones",
      "Rock",
      &         


        
5条回答
  •  一向
    一向 (楼主)
    2020-12-05 12:18

    let assume that the json is the encoded data

    var arrayOfData : [String] = []
    dispatch_async(dispatch_get_main_queue(),{
        for data in json as! [Dictionary]
        {
            let data1 = data["People"]
    
            arrayOfData.append(data1!)
        }
    })
    

    You can now use the arrayOfData. :D

提交回复
热议问题