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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:24:39+00:00 2026-05-27T03:24:39+00:00

Im facing some problem with json and objective c. Atm i am using sbJson

  • 0

Im facing some problem with json and objective c. Atm i am using sbJson framework (i can change framework if some tell me do it!) and im not being able to parse a json array.

this is the json i want to parse,

{"JsonEventosResult":
    [
        {"nombre":"Venta de Reposición N°13","id":34,"fecha":"16/09/2011"},
        {"nombre":"evento rose","id":37,"fecha":"04/10/2011"},
        {"nombre":"Prueba PhoneGap","id":40,"fecha":"23/11/2011"}
    ]
}

this is my code on iphone:

- (void)connectionDidFinishLoading:(NSURLConnection *)connection {      
[connection release];

NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
[responseData release];

NSError *error;
SBJSON *json = [[SBJSON new] autorelease];
NSArray *luckyNumbers = [json objectWithString:responseString error:&error];
[responseString release];   

if (luckyNumbers == nil)
    label.text = [NSString stringWithFormat:@"JSON parsing failed: %@", [error localizedDescription]];
else {      
    NSMutableString *text = [NSMutableString stringWithString:@"Lucky numbers:\n"];

    for (int i = 0; i < [luckyNumbers count]; i++) 
        [text appendFormat:@"%@\n", [luckyNumbers objectAtIndex:i]];

    label.text =  text;
}
}

the error i get is that luckyNumbers is an array with 0 object.

the sample i got if from http://mobileorchard.com/tutorial-json-over-http-on-the-iphone/ .

so where is the problem? the json i get form service or the framework ?

thx

  • 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-27T03:24:39+00:00Added an answer on May 27, 2026 at 3:24 am

    You’re handling it wrong. It’s not an array, it’s a dictionary, the value for key @”JsonEventosResult” is the array. So In your JSON objectwithstring line, make that an nsdictionary and then point to that key

    OR remove the {“JsonEventosResult”: and final } so that it already is an array

    Oh, and I think you’ll have to Unicode escape your accented characters and degree symbol (test your JSON at jsonlint.org to make sure it’s valid)

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

Sidebar

Related Questions

Hi guys I am using entity framework, I am facing some problem while checking
I am facing some problem while returning data from web services. I am using
I'm facing some problem when I fetch page content of particular Id. I'm using
I am facing some problem in generating oauth_signature for flickr api. Can you please
I am facing some issues while serializing objects (I am using JBoss Drools, and
I'm working using scriptaculous library. However I'm facing some issues with inclusion of the
I'm using JSON-Framework in my project successfully to decode JSON send from a server.
I am facing some problem with UISlider programming. 1) style: I know we have
I am facing some problem with MySQL database. actually It was fast when I
I am facing some problem in iPhone application development for Reading PDF. I have

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.