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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:25:51+00:00 2026-05-16T03:25:51+00:00

I am using touch JSON which worked out pretty well for me. I was

  • 0

I am using touch JSON which worked out pretty well for me. I was able to take an array, put it in a dictionary, serialize it via touchJSON and send it out via http.

Now on the return end, I received the data, and put it into a dictionary (I’m using trends.json from twitter as an example JSON).

If I try to get the value for trends from the dictionary object, I get this:

2010-08-02 00:23:31.069 rateMyTaxi[30610:207] ANSWER: (
  {
    name = "Fried Chicken Flu";
    url = "http://search.twitter.com/search?q=Fried+Chicken+Flu";
  },
  {
    name = "Lisa Simpson";
    url = "http://search.twitter.com/search?q=Lisa+Simpson";
  },
  {
    name = "#breakuplines";
    url = "http://search.twitter.com/search?q=%23breakuplines";
  },
  {
    name = "#thingsuglypeopledo";
    url = "http://search.twitter.com/search?q=%23thingsuglypeopledo";
  },
  {
    name = "Inception";
    url = "http://search.twitter.com/search?q=Inception";
  },
  {
    name = "#sharkweek";
    url = "http://search.twitter.com/search?q=%23sharkweek";
  },
  {
    name = "JailbreakMe";
    url = "http://search.twitter.com/search?q=JailbreakMe";
  },
  {
    name = "Kourtney";
    url = "http://search.twitter.com/search?q=Kourtney";
  },
  {
    name = "Shark";
    url = "http://search.twitter.com/search?q=Shark";
  },
  {
    name = "Boondocks";
    url = "http://search.twitter.com/search?q=Boondocks";
  }
)

If I try to get the value for name or URL, I get nothing which is frustrating. That is the data I will need. You can tell it is in a dictionary format because it is formatted and it is reading properly sort of for trends. I’m pretty sure I’m missing something, so please let me know which direction to follow.

Here is the code:

// this is all touch JSON magic. responseString has the full contents of trends.json

 NSString *response = [request responseString];
 NSLog(@"response value is:%@",response);

 NSString *jsonString = response;
 NSData *jsonData = [jsonString dataUsingEncoding:NSUTF32BigEndianStringEncoding];
 NSError *error = nil;
 NSDictionary *dictionary = [[CJSONDeserializer deserializer] deserializeAsDictionary:jsonData error:&error];
//end of touchJSON.  It is in a dictionary now.

 NSLog(@"dictionary:%@, error %@", dictionary, error); //http://cl.ly/adb6c6a974c3e70fb51c

 NSString *twitterTrends = (NSString *) [dictionary objectForKey:@"trends"];
 NSLog(@"ANSWER:%@",twitterTrends); //http://cl.ly/fe270fe7f05a0ea8d478
  • 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-16T03:25:52+00:00Added an answer on May 16, 2026 at 3:25 am

    When you use print an object using a formatstring %@ you will infact get the output of the description message send to the object. For a NSDictionary this output looks very similar to unparsed JSON, but it is not a string, it’s an object graph of NSDictionaries, NSArrays, NSStrings, NSNumbers and NSDates.

    So want you have in twitterTrends an NSArray of NSDictionaries. To get the parts just enumerate the Array.

    for (NSDictionary* trend in twitterTrends) {
        NSString* url = [trend objectForKey:@"url"];
        NSString* name = [trend objectForKey:@"name"];
    }
    

    Or you may access a trend by its index:

    [[twitterTrends objectAtIndex:5] objectForKey:@"url"];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

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.