Is there an easy way for me to pull out a particular value from an NSDictionary, without calling objectForKey for each level I want to go down?
For example:
{
response = {
data = {
foo = "bar";
};
user = {
"first_name" = "Joe";
"last_name" = "Bloggs";
};
};
}
Is there any easy way to pull out first_name? In reality, my data is much more nested than this, and I want to pull out data at various different levels.
Thanks.
Key Value Coding is your friend!
Using KVC, you should be able to do something like:
Here’s another related question with answers that may help you which also points to another question with further elaboration.
Here is the documentation for
valueForKeyPath:.