With the following way…
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString* path = [documentsDirectory stringByAppendingPathComponent:
[NSString stringWithFormat:@"/lkj/"]];
NSString *fileName = [NSString stringWithFormat:@"/sandbox/2012_05_11.json"];
[[self restClient] loadFile:fileName intoPath:path];
NSString *fileContent = [[NSString alloc] initWithContentsOfFile:path];
SBJsonParser *parser = [[SBJsonParser alloc] init];
NSDictionary *data = (NSDictionary *) [parser objectWithString:fileContent error:nil];
// getting the data from inside of "menu"
NSString *message = (NSString *) [data objectForKey:@"message"];
NSString *name = (NSString *) [data objectForKey:@"name"];
namegroup.text = [NSString stringWithFormat:@"%@ %@",name, message];
…I am trying to parse a document I have previously made with other code…
{"message":["Untitled1a","Untitled2a","Untitled3a"],"name":["Untitled1b","Untitled2b","Untitled3b"]}
with the code above though, in name group.text, this appears…
(untitled, untitled, untitled) (untitled, untitled, untitled)
…but what I would like to do is to allocate many UITextFields, each of them in pairs, (2, 2, 2..), one field which displays the name and the other the message, so pair up 1a with 1b, 2a with 2b… obviously the fields won’t be Untitled1a, but “how are you”…
But I can’t seem to fix this issue!! Please help!!
You may try something like this: