objective c - JSON to NSMutableArray iOS -


as response request json:

{     "letters": {         "a": 0,         "b": 1,         "c": 2,         "d": 3,         "e": 4,         ...     } } 

that's code acquire json:

nsurlrequest *request = [nsurlrequest requestwithurl:[nsurl urlwithstring:url]]; afhttprequestoperation *operation = [[afhttprequestoperation alloc] initwithrequest:request]; operation.responseserializer = [afjsonresponseserializer serializer]; [operation setcompletionblockwithsuccess:^(afhttprequestoperation *operation, id responseobject) {  nslog(@"%@", responseobject);  } failure:^(afhttprequestoperation *operation, nserror *error) {     // handle error }]; 

i want fill array keys (not values) this:

array[0] = "a"

array[1] = "b" ...?

nsmutablearray *parts = [nsmutablearray new];  nsdictionary *allletters = [responseobject objectforkey:@"letters"];  (nsstring *key in [allletters allkeys]) {      nsstring *value = [allletters objectforkey: key];      [parts insertobject:key atindex:[val intvalue]]; } 

Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -