Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7688197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:51:54+00:00 2026-05-31T19:51:54+00:00

After my last question was solved the JSON I’m receiving from the server changed

  • 0

After my last question was solved the JSON I’m receiving from the server changed to the following and I’m stuck handling the mapping to save the data with Core Data.

Entity

 Key 
 - alias 
 - key
 - keyType
 - keyword
 - unid
 - until

JSON (from Server)

{
    "documents": 1026,
    "configuration": 
    {
        ...
    },
    "data": 
    [
        {
            "alias": "",
            "key": "SALUTATION",
            "keyType": "S",
            "keyword": "Mr",
            "unid": ""
        },
        ...
        {
            "alias": "Automobile",
            "key": "ACCOUNT_MARKET_SEGMENT",
            "keyType": "A",
            "keyword": "Automobile",
            "unid": ""
        }
    ],
    "documentsFound": 770,
    "maxCount": -1,
    "since": "20120326200001",
    "until": "20120326211309"
}

Now I want to map all the data from “data” plus the key “until” for the entity “Key” but can’t find the right solution. My mapping so far to get the data looks like this and works well but misses the “until”-key, of course.

RKManagedObjectMapping* keyMapping = [RKManagedObjectMapping mappingForClass:[Key class]];
keyMapping.rootKeyPath = @"data";
[keyMapping mapKeyPath:@"key" toAttribute:@"key"];
[keyMapping mapKeyPath:@"keyword" toAttribute:@"keywordEN"];
[keyMapping mapKeyPath:@"alias" toAttribute:@"alias"];
keyMapping.setDefaultValueForMissingAttributes = YES;

Thanks for your ideas!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T19:51:55+00:00Added an answer on May 31, 2026 at 7:51 pm

    You are probably going to want to do two mappings. The first mapping will enclose the entire object and will have a relationship to the nested ‘data’ path.

    RKObjectMapping *keyMapping = [RKObjectMapping mappingForClass:[Key class]];
    [keyMapping mapAttributes:@"alias", @"key", nil];
    [keyMapping mapKeyPath:@"keyword" toAttribute:@"keywordEN"];
    
    RKObjectMapping *outerMapping = [RKObjectMapping mappingForClass:[Container class]];
    [outerMapping mapKeyPath:@"data" toRelationship:@"keys" withMapping:keyMapping];
    [outerMapping mapAttributes:@"since", @"until", "maxCount", "documentsFound", nil];
    

    That will give you a new object with your metadata and then an array of the key objects on the keys attribute of your container. Rather than using the rootKeyPath, you can use the resourcePath based mapping registration on the 0.9.4 development branch (about to be released).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After asking my last question I thought the problem was solved, and the answer
One last question. The code I inherited has the following: .clearfix:after { content: .;
Ok, I'm now very confused. After my last question had several people comment about
After my last, failed, attempt at asking a question here I'm trying a more
This question comes after solving my last question , I'd like to get some
After all the answers to my last question about fine-tuning turned out to be
You may have seen my last question where I use the following to inject
After a question last night, I'm reworking a page into the scope of Galleriffic
This problem appeared after my last question here . I want to set each
Since C# doesn't have a before,after,last,first etc. as part of its foreach. The challenge

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.