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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:24:45+00:00 2026-05-25T01:24:45+00:00

I’m trying to parse a nested JSON output like this in Objective C: {

  • 0

I’m trying to parse a nested JSON output like this in Objective C:

{
-Status: {
code: 200
request: "geocode"
name: "1.304044,103.833867"
}
-Placemark: [
-{
-Point: {
-coordinates: [
103.834
1.30396
0
]
}
-AddressDetails: {
-Country: {
CountryName: "Singapore"
-Thoroughfare: {
ThoroughfareName: "Bus stop at Lucky Plaza (09048)"
}
CountryNameCode: "SG"
}
Accuracy: 9
}
id: "p1"
address: "Bus stop at Lucky Plaza (09048)"
}
-{
-Point: {
-coordinates: [
103.834
1.30444
0
]
}
-AddressDetails: {
-Country: {
CountryName: "Singapore"
AddressLine: "Lucky Plaza"
-Thoroughfare: {
-PostalCode: {
PostalCodeNumber: "238863"
}
ThoroughfareName: "304 Orchard Road"
}
CountryNameCode: "SG"
}
Accuracy: 9
}
id: "p2"
address: "Lucky Plaza, 304 Orchard Road, Singapore 238863"
}
-{
-Point: {
-coordinates: [
103.833
1.30376
0
]
}
-AddressDetails: {
-Country: {
CountryName: "Singapore"
AddressLine: "Wisma Atria"
-Thoroughfare: {
-PostalCode: {
PostalCodeNumber: "238877"
}
ThoroughfareName: "435 Orchard Road"
}
CountryNameCode: "SG"
}
Accuracy: 9
}
id: "p3"
address: "Wisma Atria, 435 Orchard Road, Singapore 238877"
}
-{
-Point: {
-coordinates: [
103.835
1.30389
0
]
}
-AddressDetails: {
-Country: {
CountryName: "Singapore"
-Thoroughfare: {
-PostalCode: {
PostalCodeNumber: "238860"
}
ThoroughfareName: "291 Orchard Road"
}
CountryNameCode: "SG"
}
Accuracy: 9
}
id: "p4"
address: "291 Orchard Road, Singapore 238860"
}
-{
-Point: {
-coordinates: [
103.834
1.30491
0
]
}
-AddressDetails: {
-Country: {
CountryName: "Singapore"
AddressLine: "Kimsia Park"
-Thoroughfare: {
-PostalCode: {
PostalCodeNumber: "228968"
}
ThoroughfareName: "1 Jalan Kayu Manis"
}
CountryNameCode: "SG"
}
Accuracy: 9
}
id: "p5"
address: "Kimsia Park, 1 Jalan Kayu Manis, Singapore 228968"
}
]
}

I have some code working, but I’m finding the nested nature of this to be pretty tough to figure out. What I’d like to get out is an array/dictionary which contains the following elements for each return record: coordinates, CountryName, ThoroughfareName, PostalCode and Accuracy.

Here is my test code so far:

- (void)viewDidLoad {
    [super viewDidLoad];

    NSURL *jsonURL = [NSURL URLWithString:@"http://gothere.sg/maps/geo?output=json&ll=1.304044%2C103.833867&client=&sensor=false&callback="];

    NSString *jsonData = [[NSString alloc] initWithContentsOfURL:jsonURL];

    self.jsonArray = [jsonData JSONValue]; 

    NSLog(@"%@", jsonArray);

    [jsonURL release];
    [jsonData release];
}

My code just manages to get the raw JSON output, any thoughts/code to break it down as I’ve mentioned above.

Thanks!

As requested, some further information.

  1. Using SBJson framework.
  2. NSLog output from above:

    2011-08-30 16:44:32.605 Taxi[53070:207] {
    Placemark =     (
                {
            AddressDetails =             {
                Accuracy = 9;
                Country =                 {
                    CountryName = Singapore;
                    CountryNameCode = SG;
                    Thoroughfare =                     {
                        ThoroughfareName = "Bus stop at Lucky Plaza (09048)";
                    };
                };
            };
            Point =             {
                coordinates =                 (
                    "103.834",
                    "1.30396",
                    0
                );
            };
            address = "Bus stop at Lucky Plaza (09048)";
            id = p1;
        },
                {
            AddressDetails =             {
                Accuracy = 9;
                Country =                 {
                    AddressLine = "Lucky Plaza";
                    CountryName = Singapore;
                    CountryNameCode = SG;
                    Thoroughfare =                     {
                        PostalCode =                         {
                            PostalCodeNumber = 238863;
                        };
                        ThoroughfareName = "304 Orchard Road";
                    };
                };
            };
            Point =             {
                coordinates =                 (
                    "103.834",
                    "1.30444",
                    0
                );
            };
            address = "Lucky Plaza, 304 Orchard Road, Singapore 238863";
            id = p2;
        },
                {
            AddressDetails =             {
                Accuracy = 9;
                Country =                 {
                    AddressLine = "Wisma Atria";
                    CountryName = Singapore;
                    CountryNameCode = SG;
                    Thoroughfare =                     {
                        PostalCode =                         {
                            PostalCodeNumber = 238877;
                        };
                        ThoroughfareName = "435 Orchard Road";
                    };
                };
            };
            Point =             {
                coordinates =                 (
                    "103.833",
                    "1.30376",
                    0
                );
            };
            address = "Wisma Atria, 435 Orchard Road, Singapore 238877";
            id = p3;
        },
                {
            AddressDetails =             {
                Accuracy = 9;
                Country =                 {
                    CountryName = Singapore;
                    CountryNameCode = SG;
                    Thoroughfare =                     {
                        PostalCode =                         {
                            PostalCodeNumber = 238860;
                        };
                        ThoroughfareName = "291 Orchard Road";
                    };
                };
            };
            Point =             {
                coordinates =                 (
                    "103.83499999999999",
                    "1.30389",
                    0
                );
            };
            address = "291 Orchard Road, Singapore 238860";
            id = p4;
        },
                {
            AddressDetails =             {
                Accuracy = 9;
                Country =                 {
                    AddressLine = "Kimsia Park";
                    CountryName = Singapore;
                    CountryNameCode = SG;
                    Thoroughfare =                     {
                        PostalCode =                         {
                            PostalCodeNumber = 228968;
                        };
                        ThoroughfareName = "1 Jalan Kayu Manis";
                    };
                };
            };
            Point =             {
                coordinates =                 (
                    "103.834",
                    "1.30491",
                    0
                );
            };
            address = "Kimsia Park, 1 Jalan Kayu Manis, Singapore 228968";
            id = p5;
        }
    );
    Status =     {
        code = 200;
        name = "1.304044,103.833867";
        request = geocode;
    };
    

    }

  • 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-25T01:24:45+00:00Added an answer on May 25, 2026 at 1:24 am

    Try this :

    //NSMutableArray *addressDetails = [[NSMutableArray alloc] init];
    NSMutableArray *addressDetails = [[jsonArray valueForKey:@"Placemark"] valueForKey:@"AddressDetails"];
    
      //NSMutableArray *point = [[NSMutableArray alloc] init];
    NSMutableArray *point = [[jsonArray valueForKey:@"Placemark"] valueForKey:@"Point"];
    
    NSLog(@"%@", point);
    NSLog(@"%@", [point objectAtIndex:0]);
    
    NSLog(@"%@", addressDetails);
    

    Like wise you can get array of “id” and “address” value also.

    To get value of “coordinates” of point array, do this

    NSLog(@"%@", [[point objectAtIndex:0] valueForKey:@"coordinates"]);
    

    For AddressDetails/Country/CountryName :

    NSLog(@"%@", [[[addressDetails objectAtIndex:0] valueForKey:@"Country"] valueForKey:@"CountryName"]);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I have a text area in my form which accepts all possible characters from
I am writing an app with both english and french support. The app requests
I'm parsing an XML file, the creators of it stuck in a bunch social
I am using Paperclip to handle profile photo uploads in my app. They upload

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.