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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:24:49+00:00 2026-06-11T07:24:49+00:00

My json response from a URL is: [ {status:0, id:26, content:See info field for

  • 0

My json response from a URL is:

[
 {"status":0,
  "id":"26",
   "content":"See info field for info",
   "time":1347565292761,
    "info": {"id":"26",
    "name":"Ruti",
    "twitterPageFollowers":null,
     "facebookPageLikes":null,
     "activeEmailClients":1}
  }
 ]

I need to extract from it the following strings:

twitterPageFollowers
facebookPageLikes
activeEmailClients

How can I do it?

I tried parsing like this

NSData *urlData=[NSURLConnection sendSynchronousRequest:serviceRequest returningResponse:nil error:nil ];
    NSString *returnString=[[NSString alloc]initWithData:urlData encoding:NSUTF8StringEncoding];
    NSData *jsonData = [returnString dataUsingEncoding:NSUTF8StringEncoding];
    NSArray *json = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:nil];
    NSDictionary *response = [json objectAtIndex:0];
    NSString *info = [response objectForKey:@"info"];
    NSData *businessInfoString = [info dataUsingEncoding:NSUTF8StringEncoding];
    NSDictionary *businessInfo =
    [NSJSONSerialization JSONObjectWithData: businessInfoString
                                    options: NSJSONReadingMutableContainers
                                      error: nil];

And the return data is ok, but I get [__NSCFDictionary dataUsingEncoding:unrecognized selector sent to instance for the last NSDictionary creation from info field.
What is wrong or what is the shorter way to retrieve the above fields?

  • 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-11T07:24:50+00:00Added an answer on June 11, 2026 at 7:24 am

    When you retrieve the “info” field using [response objectForKey:@"info"];, you already get an NSDictionary! (and NOT an NSString).

    That’s why when you try to call dataUsingEncoding: on this object (that you believed was an NSString but is as NSDictionary) you get the exception.

    There is no need to retrieve the value of "info" key then converting it to NSData and converting it back a JSONObject, because it is already a JSONObject, namely an NSDictionary in your case. Why bother trying to convert it back and forth, whereas [response objectForKey:@"info"]; already returns that businessInfo dictionary that you expect at the end of your code?

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

Sidebar

Related Questions

I am getting json response from this google api service to get reverse geo
I am getting JSON response from the server..Inside that JSON string i am having
I request a JSON response from a home controlling device: NSData* responseData = [NSData
When testing a JSON response from an RSPEC controller test using DHH's JBuilder, my
I'm trying to return a JSON response from a Django view call via an
Basically, I have a JSON response from the Twitter API containing a timeline. I
I am getting a JSON in response from server: { width: 765, height: 990,
I've got this response from JSOn web service: categoria = ( { id_categoria =
I have a JSON response that is formatted from my C# WebMethod using the
I am using JSON.NET in C# to parse a response from the Klout API.

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.