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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:51:44+00:00 2026-05-23T02:51:44+00:00

I receive json from a webservice into a NSMutableData. That gets converted into a

  • 0

I receive json from a webservice into a NSMutableData.

That gets converted into a NSDictionary using TouchJson.

    NSDictionary *dictionary = [[CJSONDeserializer deserializer] deserializeAsDictionary:responseData error:&error];
NSString *strData = [dictionary objectForKey:@"cars"];

I then retrieve a string from a key from that dictionary.

The string looks like below

     {
        b = "http://schemas.datacontract.org/";
        car =     (
                    {
                "car_name" = "Honda Civic";
                year = 2011;
                "dealer" = "local honda dealer";
                "bought on" = {
                    nil = 1;
                };
                "license_number" = 1234567;
                status = ReadyToGo;
            }
)};

Essentially there can be ‘n’ records against the ‘car’ key.

when I try to convert the above to NSData using

NSData *jsonData = [strData dataUsingEncoding:NSUTF8StringEncoding];

and also

NSData *jsonData = [strData dataUsingEncoding:[NSString defaultCStringEncoding]];

but I get

[__NSCFDictionary dataUsingEncoding:]: unrecognized selector sent to instance 0x532bb70

I have tried a few other encodings available and xcode still threw up.

How can I figure out the encoding being used?

This is my first attempt at deserealizing json in objective-c.

What am I missing/doing wrong here?

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-23T02:51:45+00:00Added an answer on May 23, 2026 at 2:51 am

    I think it’s not a string at all….

    change to this and test….

    NSDictionary *dictionary = [[CJSONDeserializer deserializer] deserializeAsDictionary:responseData error:&error];
    NSDictionary *carsDictionary = [dictionary objectForKey:@"cars"];
    NSArray *arrayOfCarDictionaries = [carsDictionary objectForKey:@"car"];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using XStream and JETTISON's Stax JSON serializer to send/receive messages to/from JSON javascripts
I receive back from a webservice a string in Json like this: conversione da
I am using JSON to receive data from the web service , creating text
I am trying to parse a Json response from my webservice. I receive this
I'm trying to receive some json from my asp.net mvc webservice. ASP.NET: public JsonResult
I am trying to receive a json object back from php after sending data
I receive a date in the format below from a json file. Im not
Ok i need to use json on my iOS application to send/receive data to/from
I;m trying to parse a json string which I receive from web server as
I have an app that received JSON data from the server. Currently when I

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.