here is my JSON Output I got:
{
"success":true,
"return":{
"an":[
{
"ordner_id":1,
"name":"Eingang",
"gesamt":"1415",
"ungelesen":"0"
},
{
"ordner_id":3,
"name":"Gel\u00f6scht"
},
{
"ordner_id":"42864",
"name":"Test1",
"gesamt":"0",
"ungelesen":"0"
}
],
"von":[
{
"ordner_id":2,
"name":"Gesendet"
},
{
"ordner_id":3,
"name":"Gel\u00f6scht"
}
]
}
}
I can get the “success” and the “return” value easily (BOOL and NSDictonary) with this lines:
NSDictionary *ensFolderListFirstReturn = [ENSHandler GetENSFolderList];
BOOL success = [[ensFolderListFirstReturn objectForKey:@"success"] boolValue];
if (success)
{
ensFolderList = [ensFolderListFirstReturn objectForKey:@"return"];
}
But when I try to get the “an”-value with this:
NSDictionary *ensFolderList1 = [ensFolderList objectForKey:@"an"];
I got a BAD EXEC-error.
What am I doing wrong?
Looks like the “an” value holds a list, not a dictionary. Try:
Each element of that array will hold an NSDictionary.