I am using RestKit 0.9.4. I would like to post a JSON that has a key that needs to be populated from an object’s attribute.
The JSON is as follows:
{
"types":[ {
"1" : "value1"
},
{
"7" : "value2"
} ]
}
I have an object with 2 NSString data members named keytype and value respectively .
keytype is the variable that has the values that appear for the key in the nested json above ( “1”, “7” etc above ). mapKeyOfNestedDictionaryToAttribute will probably not work here because the dynamic attribute( to be used as key) is at the inner most level..
Can this be posted using RestKit?
Here’s how you make that structure in an NSDictionary, and then post it as JSON using RestKit. Also, the response then maps to a model.