Parse JSON using Swift / SwiftyJSON

前端 未结 2 1329
清歌不尽
清歌不尽 2021-01-28 08:11

I\'ve followed several tutorials on this, and as far as I can tell what I\'m doing should be working. I have the following json response from an api call

{
             


        
相关标签:
2条回答
  • 2021-01-28 08:48

    What library are you using for handle json? If swift json you can do something like

    res["id"]?.string
    

    If you don't say anything on the type of "res" we can't answer you.

    0 讨论(0)
  • 2021-01-28 08:50

    I think you want something like this:

    ApiConnector.sharedInstance.login(emailText.text!, password: passwordText.text!) { (res) in
        if let id = res["Id"].string {
          // Do something.
        }
    }
    
    0 讨论(0)
提交回复
热议问题