5

I'm using the JSON framework found here: http://stig.github.com/json-framework in my iPhone app. I'm trying to parse out some data into an NSArray (order matters so a dictionary won't work)

I get the JSON string ok from the server and this is what it looks like:

{"users":["[email protected]","[email protected]","[email protected]"]}

what I would like to end up with is an NSArray so that:

myArray[0] == "[email protected]"
myArray[1] == "[email protected]"
myArray[3] == "[email protected]"

this should be really easy, but it's not for me the closest I can get is this output:

("[email protected]","[email protected]","[email protected]")

from this code

NSDictionary *dictionary = [jsonString JSONValue];
for(NSString *key in dictionary){
    NSLog(@"Dictionary value for \"%@\" is \"%@\"",key, [dictionary objectForKey:key]);
}

any help would be appreciated!

1 Answer 1

10
NSArray *myArray = [dictionary objectForKey:@"users"];
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.