Restkit post with core data entities and relationship -


i trying post contents of entity(articles) , relationship(authors) restkit object mapping.

articles <->> authors article can have many authors.

my current object mapping below,

    rkobjectmapping *authormapping = [rkobjectmapping requestmapping];     [authormapping addattributemappingsfromarray:@[@"name",@"email"]];      rkobjectmapping *articlemapping = [rkobjectmapping requestmapping];    [articlemapping addattributemappingsfromarray:@[@"title",@"body",@"date"]];     rkrelationshipmapping * rel =[rkrelationshipmapping relationshipmappingfromkeypath:@"author" tokeypath:@"author" withmapping:authormapping];    [articlemapping addpropertymapping:rel];      rkobjectmapping *mapping = [rkobjectmapping requestmapping];    [mapping addpropertymapping:[rkrelationshipmapping relationshipmappingfromkeypath:@"singlearticle" tokeypath:@"singlearticle" withmapping:articlemapping]]; 

for mapping expecting json output array of authors below,

  {     "singlearticle": {         "author": [             {                 "email": "dadsa@",                 "name": "rk"             },             {                 "email": "3ldll",                 "name": "rjk"             }         ],         "body": "body content",         "date": "2014-05-16t15:54:40z",         "title": "some title"     } } 

but generated json output turns out fields in author class separate object below,

{     "singlearticle": {         "author": [             {                 "email": "dadsa@"             },             {                 "name": "rk"             },             {                 "email": "3ldll"             },             {                 "name": "rjk"             }         ],         "body": "body content",         "date": "2014-05-16t15:54:40z",         "title": "some title"     } } 

i not sure how missing here messes json feed above. thoughts produce proper json array of author objects?


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -