I have an NSDictionary
that is getting a JSON
file. This is my JSON
file:
{
"People": {
"Downtown": [
{
"firstName": "Steve",
"lastName": "Smith",
"Color": "Blue",
},
{
"firstName": "John",
"lastName": "Doe",
"Color": "Red",
}
]
}
}
In Xcode I used a NSLog
to display the whole file and it works, but now I would like to call on for example the second object in the JSON
array and extract the last name giving me the value "Doe"
allowing me to put it in a NSString
in Xcode.
I tried
NSLog(@"This is in dictionary: %@", [dictionary objectForKey: @"People"]);
in Xcode, witch got me closer but still pretty far. I'm thinking it's something along the lines of –objectForKey:
, but Im pretty new to NSDictionary
so I don't know all the syntax or how to use it properly.