In RestKit is there an easy way to include a parent reference in a child object? For instance if I have JSON that looks like this:
{
"parent": {
"name": "Jim",
"child": {
"name": "John"
}
}
}
How do I configure the RKObjectMapping such that my “child” object has a “parent” reference (i.e. child.parent)?
I’ve come up with a decent workaround because this doesn’t appear to be directly supported by RestKit.
What you need to do is use key-value validation to place the parent reference into the child object. So, for the above example the Parent model would look something like this: