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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:49:52+00:00 2026-05-24T23:49:52+00:00

I am trying to get the JSON data I will be getting back from

  • 0

I am trying to get the JSON data I will be getting back from a forward geocoding web service API.
The respond format is as follow.

  [
    {"total":63},{
        "t":"1",
        "lable":"Gek Poh Shopping Centre",
        "address":"762 Jurong West Street 75. (S)640762",
        "street":"Jurong West Street 75",
        "zip":"640762",
        "long":"103.6980151847",
        "lat":"1.348986165348",
        "x":"355149.0357","y":
        "149142.5301",
        "is_prem":"0",
        "pid":"47120",
        "aid":"115810",
        "lid":"245690",
        "has_biz":"1",
        "is_main_building":"1",
        "id":"245690",
        "cat_id":"80"
        },
        {
        "t":"1",
        "lable":"Gek Poh Ville Community Club (CC)",
        "address":"1 Jurong West Street 74. (S)649149",
        "street":"Jurong West Street 74",
        "zip":"649149",
        "long":"103.69890252806",
        "lat":"1.3489703630875",
        "x":"355247.7723",
        "y":"149140.7302",
        "is_prem":"0",
        "pid":"2979",
        "aid":"116734",
        "lid":"127311",
        "has_biz":"1",
        "is_main_building":"1",
        "id":"127311",
        "cat_id":"14"
        }
    ]

Here’s what I did.

-(IBAction)search:(id) sender{
    self.requestString = [NSString stringWithFormat:@"http://www.streetdirectory.com/api/?mode=search&act=all&profile=sd_default&q=%@&show_additional=0&output=json&limit=1", textField.text];
    NSString *escapedString = [self.requestString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    self.request = [NSURLRequest requestWithURL:[NSURL URLWithString:escapedString]];

    responseData = [[NSMutableData alloc] init];
    rConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self startImmediately:YES];

}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {

    [responseData appendData:data];
}
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
    SBJsonParser *parser = [[SBJsonParser alloc] init];
    NSDictionary *responseDict = [parser objectWithData:responseData];

    NSArray *resultsArray = [responseDict valueForKey:@""];   // am I doing it correctly to get the array?
    for (NSDictionary *childDic in resultsArray) {
        NSString *str = [childDic objectForKey:@"address"]; // for example I wanna get the address?
        label.text = str;
    }
}
  • 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-24T23:49:52+00:00Added an answer on May 24, 2026 at 11:49 pm

    You didn’t say exactly what problem you are encountering, so I’ll start by guessing based on what you did post.

    It looks to me like your top level JSON object should be an array with 3 dictionaries within it:

    NSArray *responseArray = [parser objectWithData:responseData];
    

    The first dictionary in the array seems to be a dictionary with a single total value:

    NSDictionary *totalDict = [responseArray objectAtIndex:0];
    NSLog(@"Total: %@", [totalDict objectForKey:@"total"]);
    

    The remaining dictionaries seem to have records that contain an address:

    for (int i = 1; i < [responseArray count]; i++) {
        NSDictionary *dict = [responseArray objectAtIndex:i];
        NSLog(@"Address %d = %@", i, [dict objectForKey:@"address"]);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get some errors returned in JSON format. So, I made
I am trying to get the data from the php file and update every
I'm trying to get request a json object from the server each 10 seconds
Trying to get a JSON output to work with jqGrid 'userdata' option. The example
While trying to GET a JSON, my callback function is NOT firing. $.ajax({ type:GET,
I'm trying get values from a GridView using the following code: foreach (GridViewRow row
Trying to get this example working from http://www.munna.shatkotha.com/blog/post/2008/10/26/Light-box-effect-with-WPF.aspx However, I can't seem to get
Trying to get parameters from a PUT request using HttpServlet#doPut: public void doPut(HttpServletRequest request,
I am trying to create a glossary system which will get a list of
I'm trying to query the OpenCalais service semanticproxy.com. Unfortunately, their url format is as

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.