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

The Archive Base Latest Questions

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

Currently I am using the following code to parse the JSON link sent. This

  • 0

Currently I am using the following code to parse the JSON link sent. This is how I also send a GET call to the Google Reader API for an upcoming iPhone application of mine.

- (NSArray *)subscriptionList
{
if(!cookies && [cookies count] == 0) {
    [self requestSession];
}

NSString * url = @"http://www.google.com/reader/api/0/subscription/list?output=json&client=scroll";

ASIHTTPRequest * request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:url]];
[request setRequestMethod:@"GET"];
[request setRequestCookies:cookies];
[request addRequestHeader:@"Authorization" value:[NSString stringWithFormat:@"GoogleLogin auth=%@", [self auth]]];

[request startSynchronous];

subfeeds = [NSMutableArray array];

// Create new SBJSON parser object
SBJSON *parser = [[SBJSON alloc] init];

if ([request responseStatusCode] == 200) {

    NSData * sixty = [request responseData];

    NSString * body = [[NSString alloc] initWithData:sixty encoding:NSUTF8StringEncoding];
    if (body) {
        NSArray *feeds = [parser objectWithString:body error:nil];
        NSLog(@"Array Contents: %@", [feeds valueForKey:@"subscriptions"]);
        NSLog(@"Array Count: %d", [feeds count]);

        NSDictionary *results = [body JSONValue];
        NSArray *ohhai = [results valueForKey:@"subscriptions"];

        for (NSDictionary *title in ohhai) {
            subTitles = [title objectForKey:@"title"];
            NSLog(@"title is: %@",subTitles);
        }
    }
}

return subfeeds;
[subTitles release];
[parser release];
}

I can successfully parse the JSON using the above code, and it successfully outputs the titles into NSLog. In my RootViewController.m, I call the following to grab this -(NSArray *)subscriptionList.

-(void)viewDidAppear:animated {
GoogleReader * reader = [[GoogleReader alloc] init];
[reader setEmail:gUserString];
[reader setPassword:gPassString];

//feedItems is a NSArray where we store the subscriptionList NSArray
feedItems = [reader subscriptionList];

//NSString *feedTitle = [];

NSLog(@"%@", feedItems);

[reader release];
// the rest of the function
}

The code above successfully works with the credentials entered. As you can see there is also a commented NSString called feedTitle. This is where I want to pull the @”title” from the parsed JSON but I do not know how to call it.

Any help would be greatly appreciated!

This is what the JSON source looks like:

{"subscriptions":
[
{"id":"","title":"","categories":[],"sortid":"","firstitemmsec":""},
{"id":"","title":"","categories":[],"sortid":"","firstitemmsec":""},
{"id":"","title":"","categories":[],"sortid":"","firstitemmsec":""},
{"id":"","title":"","categories":[],"sortid":"","firstitemmsec":""},
{"id":"","title":"","categories":[],"sortid":"","firstitemmsec":""}
]
}

I’m interested in only the “title” node.

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

    Well, it would help if you added the source JSON but it’s quite easy to grasp how SBJSON parses incoming JSON.

    Just an example:

    { "myOutDict" : { "key1": "val1" , "key2" : "val2"} }
    

    This JSON String would be parsed so you can access it by using this code

    NSDictionary* myOuterdict = [feeds valueForKey:@"myOutDict"]);
    NSString* val1 =  [myOuterdict valueForKey:@"key1"]);
    NSString* val2 =  [myOuterdict valueForKey:@"key2"]);
    

    Edit: Checked my personal Google Reader feed:

    The JSON looks like this

    {
        "subscriptions": [{
            "id": "feed/http://adambosworth.net/feed/",
            "title": "Adam Bosworth's Weblog",
            "categories": [],
            "sortid": "0B5B845E",
            "firstitemmsec": "1243627042599"
        },
        {
            "id": "feed/http://feeds.feedburner.com/zukunftia2",
            "title": "Zukunftia",
            "categories": [],
            "sortid": "FCABF5D4",
            "firstitemmsec": "1266748722471"
        }]
    }
    

    So the corresponding Objective C Code would be:

    NSArray* subscriptions= [feeds valueForKey:@"subscriptions"]);
    foreach(NSDictionary* item in subscriptions) {
        // Do stuff 
        // NSString* title = [item valueForKey:@"title"]
        // NSString* id = [item valueForKey:@"id"]
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently using the following code to append a X link to each element
I'm currently using the following PHP code: // Get all subordinates $subords = array();
I'm currently using the following code to parse a part of an Xml file
I am currently using the following code to get the email id of the
I currently have the following code to parse a csv file using the standard
Currently I am using the following code to print a large data structure print(json.dumps(data,
I am currently using the following code to update form data before submission. $('.countyx').change(function(){
I'm currently using the following code (C#): private static void PlayLoop(string filename) { Audio
Hey I am currently using the following code Dim flickr As New Flickr(apikey) Dim
I'm currently using StructureMap to inject instances of NHibernate ISessions using the following code:

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.