Migrating from JSON to NSArray

I am using the JSON framework found here: http://stig.github.com/json-framework in my iPhone app. I'm trying to parse some data in NSArray (order matters, so the dictionary will not work)

I get the JSON ok line from the server and it looks like this:

{"users":["example1@examle.com","example2@example.com","example3@example.com"]}

what I would like to get is an NSArray to:

myArray[0] == "example1@example.com"
myArray[1] == "example2@example.com"
myArray[3] == "example3@example.com"

It should be very simple, but it is not for me, the closest I can get this conclusion:

(" example1@example.com ", " example2@example.com ", " example3@example.com ")

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!

+5
1
NSArray *myArray = [dictionary objectForKey:@"users"];
+10

All Articles