Looking at the data you posted, I see an outer array of dictionaries. Each of those dictionaries contains it’s own array of dictionaries. The inner dictionary contains your actual data, with keys NodeContent and NodeName.
I’m guessing you want to traverse all the innermost dictionaries, looking for entires with a nodeName value of “MyID”, and collect an array of the NodeContent values for those dictionaries.
To diagram your data structure, this is what I see:
Array
Dictionary
array
Dictionary
So the code might look like this:
NSMutableArray *nodeContents = [NSMutableArray new];
for (NSDictionary *outerDict in outerArray)
{
NSArray *nodeChildArray = outerDict[@"nodeChildArray];
for (NSDictionary innerDict in nodeChildArray)
{
if ([innerDict[@"nodeName"] isEqualToString "MyID"])
{
NSString *thisNodeContent = innerDict[@"nodeContent"];
if (thisNodeContent != nil)
[nodeContents addObject: thisNodeContent];
}
}
}
solved Get specific NSMutableArray values [closed]