ios - How to get the String Value in JSON -
this json
{ "statusresponse": { "statuscode": "000" "statusdescription": "operation success(000)" "debugdescription": "operationsuccess" }- "memid": "3e369fec-a9c5-418b-a950-0647f7e15d7c" "token": null "isadmin": false "isteacher": false "isparent": true "kinderid": null }
i can retrieve dictionary of statusresponse
using http method.
restapimanager.sharedinstance.makegetrequest("myurl", oncompletion: {json in result in json["statusresponse"].dictionaryvalue { print(result) } })
at here, result output this.
("debugdescription", operationsuccess) ("statusdescription", operation success(000)) ("statuscode", 000)
the question want ask how stringvalue of statuscode in code there using each loop?
use this:
if let statuscode = json["statusresponse"]["statuscode"].string { println(statuscode) }
Comments
Post a Comment