swift - Can't access JSON using SwiftyJSON -


i trying access json via alamofire:

func getdatafromserver() {     alamofire.request(.post, websiteurl, parameters: myparameters) .responsestring {         (response) -> void in         if let value = response.result.value {             let json = json(value)             self.parsejson(json)         }     } } 

,and json being returned me looks this:

{   "status":"success", "object":[     {        "name":"bob",      "age":"20 ",   },   {        "name": "jane",      "age":"25"   }, ] } 

and using swiftyjson access names:

func parsejson(json: json) {     result in json["object"].arrayvalue {         print(result["name"].stringvalue)     } } 

but not printing anything. doing wrong?

responsejson should used instead of responsestring


Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

json - Gson().fromJson(jsonResult, Myobject.class) return values in 0's -