I'm trying to wrap my HTTP POST request with a key. In other words, I want to turn this:
{
"category_id"=>"1",
"food_name_token"=>"Pizza",
"id"=>"1"
}
into this:
{
"dish" =>
{
"category_id"=>"1",
"food_name_token"=>"Pizza",
"id"=>"1"
}
}
I tried using the 'rootKeyPath' method in RestKit:
serializationMapping.rootKeyPath = @"dish";
But that gave me this weirdly formatted string :
{
"dish"=>
"{
\n \"category_id\" = 1;
\n \"food_name_token\" = Pizza;
\n id = 1;
\n}
"}
It uses equal signs and semicolons instead of arrows and commas, and adds in all these linebreaks and escape backslashes.
Any idea why? And any suggestions on what I can do instead?
P.S. I'm using a Rails backend
NSDictionary *rootDictionary = [NSDictionary dictionaryWithObject:childDict forKey:@"dish"];
This should solve it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With