programmatically creating property list from json to include an array
- by Michael Robinson
[{"memberid":"18",
"useridFK":"30",
"loginName":"Johnson",
"name":"Frank",
"age":"23",
"place":"School",
},]
Someone else posted a similar question but without the fact that it was coming from a JSON deserialization. Quinn had some suggestions but it was confused about where to place/replace the following code (if it's correct):
NSDictionary *item1 = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@" member",[NSNumber numberWithInt:3],nil]
forKeys:[NSArray arrayWithObjects:@"Title",@"View",nil]];
into this:
NSData *jsonData = [jsonreturn dataUsingEncoding:NSUTF32BigEndianStringEncoding];
NSError *error = nil;
NSDictionary * dict = [[CJSONDeserializer deserializer] deserializeAsDictionary:jsonData error:&error];
if (dict)
{
rowsArray = [dict objectForKey:@"member"];
[rowsArray retain];
}
My Array.plist needs to look like the following:
Root: Dictionary
V Rows: Array
V Item 0: Dictionary
Title: String 18
V Children Array
V Item 0 Dictionary
Title String 30
etc.
Thanks in advance. Every tutorial on JSON only shows a simple array being returned, never a 2-D..It's driving me crazy trying to figure this out.