0

I am quite new to RestKit. I know that the Object Mapping of Restkit is very powerful. However, in some case, I just want to map to a simple variable. For example, take a look at the following response:

{
    "response": 400,
    "result": {
        "error_message": "Invalid session token"
    }
}

I just want to know the value of "response" or "error_message". It's quite wasteful to create 2 classes "response", and "result", since these classes have only few fields.

Any recommendation is welcome.

Wain
  • 118,658
  • 15
  • 128
  • 151
chipbk10
  • 5,783
  • 12
  • 49
  • 85

1 Answers1

1

You can create a single class with response and message properties, then use mappings:

@"response" : @"response",
@"result.error_message" : @"message"

Or you can just map into a dictionary for error responses and then use the keypath to access the message.

Wain
  • 118,658
  • 15
  • 128
  • 151