ios - RestKit how to map an array inside an array -
here's response:
{ "status": true, "statuscode": 200, "result": [ { "name": "abc", "date": "2015-01-30", "documents": [ { "id": 1, "name": "doc1", "status": "complete", }, { "id": 2, "name": "doc2", "status": "complete", }, { "id": 3, "name": "doc3", "status": "complete", } ], "message": "hello world", "status": 3 } ] }
i want map , "document" inside array keyed "result" , don't need other objects / mappings. need documents. how can done / declared in response descriptors automatically match these documents managed object?
try :-
nsdictionary *dic=@{ @"status": @true, @"statuscode":@ 200, @"result": @[ @{ @"name": @"abc", @"date": @"2015-01-30", @"documents": @[ @{ @"id":@ 1, @"name": @"doc1", @"status": @"complete", }, @{ @"id":@ 2, @"name": @"doc2", @"status":@ "complete", }, @{ @"id":@ 3, @"name": @"doc3", @"status": @"complete", } ], @"message": @"hello world", @"status":@ 3 } ] };
i storing response in nsdictionary , -
[[[dic objectforkey:@"result"] objectatindex:0] objectforkey:@"documents"]
change indexnumber require !
Comments
Post a Comment