How do I parse an array inside parsed JSON in Swift?

前端 未结 4 692
后悔当初
后悔当初 2020-12-08 10:32

I\'m using an API that returns JSON that looks like this

{
   \"boards\":[
      {
         \"attribute\":\"value1\"
      },
      {
         \"attribute\":         


        
4条回答
  •  一个人的身影
    2020-12-08 10:43

    Take a look here:https://github.com/lingoer/SwiftyJSON

    let json = JSONValue(dataFromNetworking)
    if let userName = json[0]["user"]["name"].string{
        //Now you got your value
    }
    

提交回复
热议问题