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

前端 未结 4 687
后悔当初
后悔当初 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:57

    You can create a variable

    var myBoard: NSArray = parsedJSON["boards"] as! NSArray
    

    and then you can access whatever you have in "boards" like-

    println(myBoard[0])
    

提交回复
热议问题