This is the code i have so far
// Parse data using NSJSONSerialization
NSError *error = nil;
NSArray *JsonArray = [NSJSONSerialization JSONObjectWithData:myData options:NSJSONReadingMutableContainers error: &error];
if(!JsonArray)
{
NSLog(@"Error Parsing Data: %@", error);
}
else
{
for(NSDictionary *event in JsonArray)
{
if([[event description] isEqualToString:@"error"])
{
// Get error number? I am confused by this part
NSLog(@"Element: %@", [event objectForKey:@"error"]);
}
else
{
NSLog(@"Element: %@", [event description]);
}
}
}
this is the JSON Data that parses correctly:
[{data string}, {data strings}]
This only gives me the string "error" and not the int as well:
{"error":0}
I am echoing this data from a PHP script if that helps any. Am i just doing it wrong, or did i miss something?
error(i. e.if (event[@"error"] != nil)).SIGABRT" in itself is non-informative.