user1108720
user1108720

Reputation: 45

how can i parse dynamic json data in obj-c?

My json data could have any number of objects from a database. This all comes in fine and sends the number to objective-c in gameCount. From there I want the objectForKey to loop until it reaches gameCount. I have tried a few different things that have all failed. Here is a little snippet of the code.

int gameCount = [count intValue];
    int gameRows = 0;
    while (gameCount > gameRows) {
        gameRows++;
         NSString *thisUser = (NSString *) [dictionaryReturn objectForKey:@"away%i", gameRows];

This obviously does not work but I figured I was at least heading in the right direction.

Upvotes: 0

Views: 164

Answers (1)

tato
tato

Reputation: 5549

I don't understand the purpose of the rest of the code, but at least this part should be writen this way:

...[dictionaryReturn objectForKey:[NSString stringWithFormat:@"away%i", gameRows]]

Good luck!

Upvotes: 1

Related Questions