I have dis response
(
{
"first_name" = Akash;
idprofile = 1;
iduser = 1;
"last_name" = Testing;
picUrl = "http://qalina.acapglobal.com/kangatime/ktapp/profilepics/1/1_Jellyfish.jpg";
"profile_picture_filepath" = "1_Jellyfish.jpg";
},
{
"first_name" = testing;
idprofile = 3;
iduser = 1;
"last_name" = tst;
picUrl = "http://qalina.acapglobal.com/kangatime/ktapp/profilepics/1/3_Penguins.jpg";
"profile_picture_filepath" = "3_Penguins.jpg";
},
{
"first_name" = test;
idprofile = 4;
iduser = 1;
"last_name" = test;
picUrl = "http://qalina.acapglobal.com/kangatime/ktapp/profilepics/1/4_Chrysanthemum.jpg";
"profile_picture_filepath" = "4_Chrysanthemum.jpg";
},
{
"first_name" = prashant1;
idprofile = 19;
iduser = 1;
"last_name" = kharade1;
picUrl = "http://qalina.acapglobal.com/kangatime/ktapp/profilepics/1/19_Koala.jpg";
"profile_picture_filepath" = "19_Koala.jpg";
},
{
"first_name" = Priyank;
idprofile = 68;
iduser = 1;
"last_name" = Jain;
picUrl = "http://qalina.acapglobal.com/kangatime/ktapp/profilepics/1/68_P.jpg";
"profile_picture_filepath" = "68_P.jpg";
},
{
"first_name" = sdasd;
idprofile = 106;
iduser = 1;
"last_name" = sdasd;
picUrl = "http://qalina.acapglobal.com/kangatime/ktapp/profilepics/1/";
"profile_picture_filepath" = "<null>";
}
)
after i do dis
NSMutableArray *fNames = [NSMutableArray array];
for(NSDictionary *temp in responseArr)
{
[fNames addObject:[temp objectForKey:@"first_name"]];
}
NSLog(@"fNamesArray==>%@",fNames);
NSMutableArray *lNames = [NSMutableArray array];
for(NSDictionary *temp1 in responseArr)
{
[lNames addObject:[temp1 objectForKey:@"last_name"]];
}
NSLog(@"lNamesArray==>%@",lNames);
i get dis:
fNamesArray==>(
Akash,
testing,
test,
prashant1,
Priyank,
sdasd
)
lNamesArray==>(
Testing,
tst,
test,
kharade1,
Jain,
sdasd
)
the fNamesArray consists of first names and the lNamesArray consists of last names. Now what i have to do is to combine two arrays(firstName+lastName) and display them in table and image related to each profile and display on table rows.
Like the first row should contain
Akash Testing
second row
testing tst
and so on…
Any help would be appreciated. Thanks!!
Better you go with below…
NSMutableArray *fullNames = [[NSMutableArray alloc] init]; for(NSDictionary *temp in responseArr) { NSString *strFullName = [NSString stringWithFormat:@"%@ %@", [temp objectForKey:@"first_name"], [temp1 objectForKey:@"last_name"]]; [fullNames addObject: strFullName] } NSLog(@"fNamesArray==>%@",fullNames);Inserted for related new question…
To get array from JSON response,
How to create JSON Array string given below?