JSON Parsing in Swift 3

前端 未结 8 810
暖寄归人
暖寄归人 2020-12-01 11:05

Has anyone been able to find a way to parse through JSON files in Swift 3? I have been able to get the data to return but I am unsuccessful when it comes to breaking the dat

8条回答
  •  伪装坚强ぢ
    2020-12-01 11:29

    Use SwiftJson library. I think its very easy way to parse.

    let count: Int? = json["Field"].array?.count
    if let ct = count {            
        for index in 0...ct-1{
            let number = json ["Field"][index]["number"].string
            let name = json ["Field"][index]["name"].string 
    

    ....

    like this .

提交回复
热议问题