Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You need to convert your json string to NSDictionary object in order to used in tableView,below code will convert it to NSDictionary object and then you can set values accordingly by using its key value.</p> <pre><code>- (void)viewDidLoad { NSString *jsonString = @"{\"LinkResult\":{\"0\":{\"Name\":\"Veeva - Devon1\",\"ButtonDisplay\":\"Veeva\",\"PasswordSaving\":\"Yes\",\"Status\":\"Success\",\"Message\":\"No Error\", \"Identifiers\": {\"Identifier1Name\": \"Identifier1value\",\"Identifier2Name\": \"Identifier2value\",\"Identifier3Name\": \"Identifier3value\"},}}}"; NSData *jsondata=[jsonString dataUsingEncoding:NSUTF8StringEncoding]; NSDictionary *dataDictionary = [NSJSONSerialization JSONObjectWithData:jsondata options:0 error:nil]; displaydata=[[dataDictionary valueForKey:@"LinkResult"] valueForKey:@"0"]; NSMutableArray *mutableKeys=[[NSMutableArray alloc] initWithArray:[displaydata allKeys]]; [mutableKeys removeObject:@"Identifiers"]; keys=[[NSArray alloc] initWithArray:mutableKeys]; NSLog(@"JSON DIct: %@", displaydata); [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [keys count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *cellIdentifier=@"cellIdentifier"; UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:cellIdentifier]; if (cell==nil) { cell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier]; } cell.textLabel.text = [displaydata valueForKey:[keys objectAtIndex:indexPath.row]]; return cell; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload