Hi everyone,
This is my first post on stackoverflow so please be patient :-)
I have an Json Array of Arrays:
{
"response_type": "ok",
"total_results": 1,
"page": 1,
"total_pages": 1,
"sets": [
{
"id": 2075184,
"created": 1269989599,
"term_count": 5,
"has_images": false,
"terms": [
[
"\u9031\u672b",
"Weekend",
""
],
[
"\u65e5\u66dc\u65e5",
"Sunday",
""
],
[
"\u571f\u66dc\u65e5",
"Saturday",
""
],
[
"\u79c1",
"I, myself",
""
],
[
"\u65e5\u672c\u8a9e",
"Japanese",
""
]
]
}
]
}
I am using this code in my project to get the "terms" into an NSDictionary:
NSURL *url = [NSURL URLWithString:@"http://localhost/json"];
NSString *jsonreturn = [[NSString alloc] initWithContentsOfURL:url];
NSData *jsonData = [jsonreturn dataUsingEncoding:NSUTF32BigEndianStringEncoding];
NSError *error = nil;
NSDictionary * dict = [[CJSONDeserializer deserializer] deserializeAsDictionary:jsonData error:&error];
NSLog(@"dict1: %@", dict);
if (dict)
{
rows = [dict objectForKey:@"sets"];
}
NSLog(@"Array: %@", rows);
However I am having trouble figuring out how to get the terms separated for example:
[
"\u9031\u672b",
"Weekend",
""
],
I would like an NSArray of all the Japanese: "\u9031\u672b"(that is japanese btw) and an NSArray of all the definitions Weekend (Or a NSDictionary). However I am not sure how to separate them. We can safely assume that all the Japanese is 0 and all the definitions are 1. Any help would be wonderful!
thank you,