0

I have the below JSON as response. How can I do object mapping for it? I am 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"
}
1

1 Answer 1

1

Create a new class called Prediction with description and predictionId as properties and then use the mapper object

RKObjectMapping *mapping = [RKObjectMapping mappingForClass:[Prediction class]]; [mapping addAttributeMappingsFromDictionary:@{
@"description":   @"description",
@"id":     @"predictionId",
}];

of course after you parse the response correctly

Sign up to request clarification or add additional context in comments.

1 Comment

I am using the same. But there is no response.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.