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

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -