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 8884145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:59:37+00:00 2026-06-14T20:59:37+00:00

I have some troubles mapping a JSON Array with RestKit. This is the JSON

  • 0

I have some troubles mapping a JSON Array with RestKit.

This is the JSON File:

 "result": {"cities": [
                {"city": {"id": 2, "name": "Madrid"}, 
                 "cityImages": [{"image": {"url": "", 
                                           "image": "", 
                                           "blob": "", 
                                           "title":"Madrid"}
                                }]
                  }, 

                  {"city": {"id": 11001, "name": "Seville"}, 
                   "cityImages": [{"image": {"url": "", 
                                             "image": "", 
                                              "blob": "", 
                                              "title": "Seville Foto"}}, 
                                  {"image": {"url": "", 
                                             "image": "", 
                                             "blob": "", 
                                             "title": "Otra"}
                                   }]
                    }]
            }

Te problem is in the CityImage Array.
This is my class CityImage

@interface CityImage : NSObject 
@property (nonatomic, strong) NSString *imageURL;
@property (nonatomic, strong) NSString *image; 
@property (nonatomic, strong) NSString *imageBase64; 
@property (nonatomic, strong) NSString *title; 
@end

And this is the class City (that contains an Array of CityImages)

@interface City : NSObject
@property (nonatomic, strong) NSString *cityid;
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSArray *cityImages;

And now, this is my mapping for cityImages:

RKObjectMapping* cityImageMapping = [RKObjectMapping mappingForClass:[CityImage class] ];
[cityImageMapping mapKeyPath:@"image.url" toAttribute:@"imageURL"];
[cityImageMapping mapKeyPath:@"image.image" toAttribute:@"image"];
[cityImageMapping mapKeyPath:@"image.blob" toAttribute:@"imageBase64"];
[objectManager.mappingProvider setMapping:cityImageMapping forKeyPath:@"result.cities.cityImages"];

And for cities:

RKObjectMapping *cityMapping = [RKObjectMapping mappingForClass:[City class]];
[cityMapping mapKeyPathsToAttributes:@"city.id", @"cityid", @"city.name", @"name", nil];
[cityMapping mapKeyPath:@"cityImages.image" toAttribute:@"cityImages"];
[objectManager.mappingProvider setMapping:cityMapping forKeyPath:@"result.cities"];

When the JSON is parsed it gives me this error:

W restkit.object_mapping:RKObjectMappingOperation.m:244 Failed transformation of value at keyPath 'image.url'. No strategy for transforming from '__NSArrayI' to 'NSString'
W restkit.object_mapping:RKObjectMappingOperation.m:244 Failed transformation of value at keyPath 'image.blob'. No strategy for transforming from '__NSArrayI' to 'NSString'
W restkit.object_mapping:RKObjectMappingOperation.m:244 Failed transformation of value at keyPath 'image.url'. No strategy for transforming from '__NSArrayI' to 'NSString'
W restkit.object_mapping:RKObjectMappingOperation.m:244 Failed transformation of value at keyPath 'image.blob'. No strategy for transforming from '__NSArrayI' to 'NSString'

I think I’ve forgot something, but although I have try almost everything I’ve found, the problem persist.
Any idea?.
Thank you for your help!!

  • 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-06-14T20:59:38+00:00Added an answer on June 14, 2026 at 8:59 pm

    Try setting this for the cityImageMapping: cityImageMapping.rootKeyPath = @"image" and map your attributes as url instead of image.url

    Also, I believe you want the whole array of images instead of one image so map the cityImages array as follows:
    [cityMapping mapKeyPath:@"cityImages" toAttribute:@"cityImages"];

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

Sidebar

Related Questions

I have some troubles mapping a JSON Array to RestKit. This is what the
I have some troubles with plotting the figure. I have a file with some
I have some troubles with positioning my label/password field. With this code they both
I have some troubles while writing logs from log4net to the file. I seem
I have some troubles in dealing with this search() function that i wrote. Well,
I have some troubles finding the right key in an array: when I have
i have some troubles implementing this layout: http://deconcini.net/maurer-schneebacher/projekte/elisabethinum.html Basically i would like to display
I have some troubles with my school project. I have a class: #include Group.h
I have some troubles with getting the data from the website. The website source
I have some troubles with a method having a typed List parameter, inherited from

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.