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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:53:41+00:00 2026-05-25T21:53:41+00:00

I am using the SBJson framework found at github(brilliant stuff) https://github.com/stig/json-framework/ with example :

  • 0

I am using the SBJson framework found at github(brilliant stuff) https://github.com/stig/json-framework/

with example : http://blog.zachwaugh.com/post/309924609/how-to-use-json-in-cocoaobjective-c

This twitter example works great now.

So I change my url and

for (NSDictionary *status in statuses)
{
 // You can retrieve individual values using objectForKey on the status NSDictionary
 // This will print the tweet and username to the console
 NSLog(@"%@ - %@", [status objectForKey:@"text"], [[status objectForKey:@"user"] objectForKey:@"screen_name"]);
}

to

for (NSDictionary *status in statuses)
{
  // You can retrieve individual values using objectForKey on the status NSDictionary
  // This will print the tweet and username to the console
  NSLog(@"%@ - %@", [status objectForKey:@"text"], [[status objectForKey:@"message"] objectForKey:@"nationalad"]);
}

so my json on my page has message: and a nationalad: yet I don’t get any return or or log print out. These are the only 2 things I have changed.

Any Ideas?

This is for the edit:

 SBJsonParser *parser = [[SBJsonParser alloc] init];

// Prepare URL request to download statuses from Twitter
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.mywebpagehere.com"]];

// Perform request and get JSON back as a NSData object
NSData *response = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];

// Get JSON as a NSString from NSData response
NSString *json_string = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding];

// parse the JSON response into an object
// Here we're using NSArray since we're parsing an array of JSON status objects
NSArray *statuses = [parser objectWithString:json_string error:nil];

// Each element in statuses is a single status
// represented as a NSDictionary
for (NSDictionary *status in statuses)
{
    // You can retrieve individual values using objectForKey on the status NSDictionary
    // This will print the tweet and username to the console
    //NSLog(@"%@ - %@", [status objectForKey:@"text"], [[status objectForKey:@"message"] objectForKey:@"nationalad"]);
  //  NSLog(@"Message: %@", [status objectForKey:@"message"]);

 }
  // NSDictionary *json = [NSString JSONValue];
  NSLog(@"Status: %@", statuses);     
  // NSArray *items = [statuses valueForKeyPath:@"data.array"];
  //NSLog(@"message : %@", [[items objectAtIndex:1] objectForKey:@"message"]);

and the server page:

{
'message': "<p style=\"color:#FFFFFF;font-family:'Century Gothic',futura,'URW Gothic L',Verdana,sans-serif;\">Welcome!<\/p><p style=\"color:#FFFFFF;font-family:'Century Gothic',futura,'URW Gothic L',Verdana,sans-serif;\">Check out today's Dinner and Lunch specials below!<\/p>",
'nationalad': "<img src='http:\/\/www.mywebpage.com\/images\/national\/fullrz_3_4e81fa75ceba5_mywebpage.JPG'>"
}
  • 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-25T21:53:42+00:00Added an answer on May 25, 2026 at 9:53 pm

    That’s not valid JSON — all strings must be inside double quotation marks, including names. If you fix your server so that it outputs

    {
    "message": "<p style=\"color:#FFFFFF;font-family:'Century Gothic',futura,'URW Gothic L',Verdana,sans-serif;\">Welcome!<\/p><p style=\"color:#FFFFFF;font-family:'Century Gothic',futura,'URW Gothic L',Verdana,sans-serif;\">Check out today's Dinner and Lunch specials below!<\/p>",
    "nationalad": "<img src='http:\/\/www.mywebpage.com\/images\/national\/fullrz_3_4e81fa75ceba5_mywebpage.JPG'>"
    }
    

    (note that both message and nationalad are inside double quotation marks), SBJSON should be able to parse your JSON string.

    There’s another issue, though: your server isn’t returning an array — it’s returning a single object instead. Either fix your server code so that it returns an array of objects or, in your client code, parse a single object:

    NSDictionary *status = [parser objectWithString:json_string error:nil];
    

    Also, note that by using nil in

    NSArray *statuses = [parser objectWithString:json_string error:nil];
    

    you’re effectively telling the JSON parser not to return an error object in case there’s an error. Ignoring errors is usually a bad idea. You could do something like this:

    NSError *jsonParseError;
    NSArray *statuses = [parser objectWithString:json_string error:&jsonParseError];
    if (!statuses) {
        // there's been a parse error; look at jsonParseError
        // for example:
        NSLog(@"JSON parse error: %@", jsonParseError);
    }
    

    or this:

    NSError *jsonParseError;
    NSDictionary *status = [parser objectWithString:json_string error:&jsonParseError];
    if (!status) {
        // there's been a parse error; look at jsonParseError
        // for example:
        NSLog(@"JSON parse error: %@", jsonParseError);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am downloading data from twitter using JSON feed by using SBJSON Framework example.
I am using SBJson framework (also known as json-framework) for the iOS. When parsing
I am trying to work with JSON Feed for iphone using SBJSON Framework. I
I am using JSON framework (SBJson) for my applicaition. parsing the value by NSDictionary
I trying to make a HTTP request and parse JSON using Stig's JSON Library.
I'm using SBJson to parse some JSON result from a webservice. The problem is
this is my first iPhone application and I'm using JSON framework to decode JSON
I am using JSON (SBJson) but it's giving the error : JSONValue failed. Error
i m parsing a json url using SBJSON and everything works fine. the problem
I'm using json-framework on iPhone to connect to a web service built in asp.net.

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.