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

  • SEARCH
  • Home
  • 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 7658869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:15:30+00:00 2026-05-31T13:15:30+00:00

I had been parsing my JSON quite nicely but my server just changed on

  • 0

I had been parsing my JSON quite nicely but my server just changed on me. My JSON used to look like this:

{
    "blobs": [  
        {
            "createdOn": "2012-03-16T15:13:12.551Z",
            "description": "Fake description",
            "hint": "And a useless hint",
            "id": 400,
            "name": "Fake CA one",
            "publicId": "FF6",
            "type": 0
        },
        {
            "createdOn": "2012-03-16T17:33:48.514Z",
            "description": "No hint on this one, but it does have a description.",
            "hint": "Hint",
            "id": 402,
            "name": "Second fake one in CA",
            "publicId": "FF8",
            "type": 0
        }
    ]
}

and my mapping looked like this:

RKObjectMapping* blobMapping = [RKObjectMapping mappingForClass:[GetResponseInRegionResponse class]];

[blobMapping mapKeyPath:@"name" toAttribute:@"name"];
[blobMapping mapKeyPath:@"id" toAttribute:@"blobId"];
[blobMapping mapKeyPath:@"description" toAttribute:@"description"];
[blobMapping mapKeyPath:@"hint" toAttribute:@"hint"];

[[RKObjectManager sharedManager].mappingProvider setMapping:blobMapping forKeyPath:@"blobs"];

Now my server has changed and I get this back:

{
    "blobsList": {
        "blobs": [  
            {
                "createdOn" :"2012-03-16T15:13:12.551Z",
                "description": "Fake description",
                "hint": "And a useless hint",
                "id": 400,
                "name": "Fake CA one",
                "publicId": "FF6",
                "type": 0
            },
            {
                "createdOn": "2012-03-16T17:33:48.514Z",
                "description": "No hint on this one, but it does have a description.",
                "hint": "Hint",
                "id": 402,
                "name": "Second fake one in CA",
                "publicId": "FF8",
                "type": 0
            }
        ]
    }
}

So I added this to my mapping:

RKObjectMapping* blobsListMapping = [RKObjectMapping mappingForClass:[GetResponseInRegionResponseList class]];
[blobsListMapping mapKeyPath:@"blobsList" toAttribute:@"blobsList"];

[[RKObjectManager sharedManager].mappingProvider setMapping:blobsListMapping forKeyPath:@"blobsList"];

And are are my Classes:

@interface GetResponseInRegionResponse : NSObject
{
    NSString* name;
    NSString* blobId;
    NSString* description;
    NSString* hint;
}       

@interface GetResponseInRegionResponseList : NSObject
{
    NSArray  *blobsList;
}

When I parse this JSON, I get one object that has a JKArray of 2 objects in it, both of those are JKDictionary objects. So clearly that is my data, but it is in JKDictionary form. It never mapped to the GetResponseInRegionResponse class!

From reading the github docs it looks like I want to use a toRelationship method for arrays, but I’m just not seeing where to put it. If I follow the “articles” example and try this:

[blobListMapping mapKeyPath:@"blobs" toAttribute:@"blobsList"];
[blobListMapping mapKeyPath:@"blobs" toRelationship:@"blobsList" withMapping:blobMapping];

I get this exception:

2012-03-19 14:59:53.704 Ferret[8933:16303] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unable to add mapping for keyPath blobsList, one already exists...'

So how can I map an array of complex objects inside my JSON?

I appreciate any help. Thanks!

  • 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-31T13:15:30+00:00Added an answer on May 31, 2026 at 1:15 pm

    Have you tried only changing

        [[RKObjectManager sharedManager].mappingProvider setMapping:blobMapping forKeyPath:@"blobsList.blobs"];
    

    to reflect the changed path to your data array?

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

Sidebar

Related Questions

I had been working on server side(c#) for a couple of years. But now
I know this question had been asked a hundred times, but I have difficulties
I had been asked to build crystal reports for an application, i used the
I've been parsing poker hand histories for the past year and have learned quite
I've been trying to find out why this 'json_encode'd string isn't parsing out correctly,
I used to have trouble parsing json, before I found a really good tutorial
I had been trying to get the tag name and its value in java
I had been developing a console application, until our project needed a fancy UI
I had been racking my brains over creating a vertical alignment in css using
From previous experience I had been under the impression that it's perfectly legal (though

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.