this json web response response.
-itinerary: [ -{ id: "1", valueone: "2473.05", valuetwo: "368.95" }, -{ id: "2", valueone: "2453.05", valuetwo: "308.95" } ], -details :[ -{ id:"1", firstname:"graham", lastname:"json" }, -{ id:"1", firstname:"anuradh", lastname:"stackoverflow" } ]
what should response
object type.i this, correct or not matter whatever type
nsdictionary *results = (nsdictionary *)responseobject;
then response.now want itinerary
details , details
itinerary id
equal details id
.how can that.
nsarray *itinerary = [resulsts objectforkey=@"itinerary"]; nsarray *itinerary = [resulsts objectforkey=@"detailss"]; for(nsdictionary *itinry in itinerary) { nsstring *iid = [itinry objectforkey="id"]; nsstring *valone = [itinry objectforkey="valueone"]; //like i'm getting values //then here want details it's `itinerary` `id` equal `details` `id`.how can that. }
then here want details it's itinerary
id
equal details
id
.how can that.
please try code hope work
nsarray *itinerary = [resulsts objectforkey=@"itinerary"]; nsarray *dtinerary = [resulsts objectforkey=@"detailss"]; for(int i=0; i<itinerary;i++) { nsstring *iid=[[itinerary objectatindex:i] objectforkey:@"id"]; nsstring *did=[[dtinerary objectatindex:i] objectforkey:@"id"]; if ([iid isequaltostring:did]) { // thinks here nslog(@"%@",[[itinerary objectatindex:i] objectforkey:@"valueone"]); // break; } // nsstring *iid = [itinry objectforkey="id"]; // nsstring *valone = [itinry objectforkey="valueone"]; //like i'm getting values //then here want details it's `itinerary` `id` equal `details` `id`.how can that. }
Comments
Post a Comment