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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:51:02+00:00 2026-06-09T04:51:02+00:00

I used to have trouble parsing json, before I found a really good tutorial

  • 0

I used to have trouble parsing json, before I found a really good tutorial which I could follow. When I have been building my own webservices to parse json from I have followed the same steps, but now when I’m trying to parse twitters json-feed I’m drawing blanks. Here’s my code.

NSError* error;
NSDictionary* json = [NSJSONSerialization 
                      JSONObjectWithData:responseData //1

                      options:kNilOptions 
                      error:&error];

NSArray* itemNumber = [json objectForKey:@"posts"]; //2

NSUInteger numObjects = [itemNumber count];


arrayTweets = [[NSMutableArray alloc] init];
arrayTimes = [[NSMutableArray alloc] init];


if (numObjects != 0) {

    int i = 0;
    do
    {
        NSDictionary* loan = [itemNumber objectAtIndex:i];


        NSString* text = [(NSDictionary*)loan objectForKey:@"text"];
        [arrayTweets addObject:text];

        NSString *time = [(NSDictionary*)loan objectForKey:@"created_at"];
        [arrayTweets addObject:time];

        i++;

    } while (i < numObjects);


} else {
    NSLog(@"Nej");
}

[tableTweet performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO];

Notice the “NSArray* itemNumber = [json objectForKey:@”posts“];”. Since my old json-feed used to look something like this…

{"status":"ok","count":4,"count_total":4,"pages":1,"posts":[{"id":58,"type":

it was working since I had the “posts” before :[, but now with the twitter feed it just starts right into:

[{"created_at":"Mon Aug 06 19:16:42 +0000 2012","id":232555817835048961,"...

And I have no idea what to do. I realize this is stupid, but I don’t think I’m going to learn unless someone explains it to me.

Any help appreciated!

  • 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-09T04:51:03+00:00Added an answer on June 9, 2026 at 4:51 am

    Aah, there is a small problem with your code. The root object of your previous feed used to be a dictionary. You can see this by the { sign at the beginning. Your new feed instantly gives you an array back [. So you don’t have to parse your data as a dictionary but as as NSArray. Without further ado, explanation here: https://stackoverflow.com/a/8356919/341358

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

Sidebar

Related Questions

Little trouble in using css, in the below code, i have used odd and
I have used this code (kind of tutorial) at http://code.google.com/p/gwt-examples/wiki/gwt_hmtl5 ... In this code,
This question is pretty generic actually, but I'm really having trouble finding a good
I have trouble to understand how dependency properties can be used between C# and
I have a contact that is experiencing trouble with SAX when parsing RSS and
I have trouble using SSL pages with JMeter, which I previously posted here .
I've recently found the resx resources feature of C#/VS2008. However, I have trouble finding
i have used observed_field for arrays of data... but i am having trouble making
I have been having a ton of trouble because I have forgotten all of
I'm trying to use PHP to process JSON and am having trouble parsing it

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.