programmatically creating property list from json to include an array

Posted by Michael Robinson on Stack Overflow See other posts from Stack Overflow or by Michael Robinson
Published on 2010-06-14T05:09:43Z Indexed on 2010/06/14 5:12 UTC
Read the original article Hit count: 285

[{"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.

© Stack Overflow or respective owner

Related posts about JSON

Related posts about uitableview