-4
{"data":[
         "",{"id":"1","nom":"hello","message":["",{"id":1,"nom":"dad"}]},
            {"id":"2","nom":"hi","message":["",{"id":"1","nom":"marie"},{"id":"2","nom":"bob"}]}
        ]
} 

how can i extract data form it using iOS

kokio
  • 53
  • 7

2 Answers2

0

Make use of NSJSONSerialization .

NSError *jsonError = nil;
id allValues = [NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding]
                                                                      options:0
                                                                        error:&jsonError];

if(jsonError!=nil)
   NSLog(@"Json_Err: %@",jsonError);

NSArray *result = [(NSDictionary*)allValues objectForKey:@"data"];
βhargavḯ
  • 9,786
  • 1
  • 37
  • 59
0

Integrate the Json sdk for your project and place the below code like this...

NSStrig *jsonString = @"your json string";
NSDictionary *responseDictionary = [jsonString JSONValue];
nsgulliver
  • 12,655
  • 23
  • 43
  • 64
Bhanu Prakash
  • 1,493
  • 8
  • 20