ios - JSON Object Mapping - RestKit -
i have below json response. how can object mapping it? using ios - restkit.
{ "predictions":[ { "description":"user1", "id":"75b8c57b4443f4b881f0efc94afd52437232aee9" }, { "description":"user2", "id":"82aa3303704041cda0e4fc34024d383dbf923604" }, { "description":"user3", "id":"f88f669a30934ef599bccf86c0236426cf2d313e" }, { "description":"user4", "id":"fa9ae7b65fa52bffdabf00d69e7db5cd37539781" }, { "description":"user5", "id":“66df3fd7e400eb31efd3ac935036aab2c02b03f0" } ], "status":"ok" }
create new class called prediction
description
, predictionid
properties , use mapper object
rkobjectmapping *mapping = [rkobjectmapping mappingforclass:[prediction class]]; [mapping addattributemappingsfromdictionary:@{ @"description": @"description", @"id": @"predictionid", }];
of course after parse response correctly