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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:20:16+00:00 2026-05-27T19:20:16+00:00

I am unsure how to parse nested JSON output. I am using Googles JSON

  • 0

I am unsure how to parse nested JSON output. I am using Googles JSON geocoding and trying to extract the coordinates. I am thinking I need another level of parsing. My code that does not work:

hostStr = [hostStr  stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

NSURL *hostURL = [NSURL URLWithString:hostStr];
NSString *jsonString = [[NSString alloc] initWithContentsOfURL:hostURL];

self.jsonArray = [jsonString JSONValue]; 

NSDictionary *coordinates = [self.jsonArray objectForKey:@"id:p1"];
NSLog(coordinates);
NSString *point = [coordinates objectForKey:@"Point"];
NSLog(point);

The JSON:

{
"name": "11111 WASHINGTON AVE # 116 SAN PEDRO, CA 91111",
"Status": {
"code": 200,
"request": "geocode"
},
"Placemark": [ {
"id": "p1",
"address": "11111 Washington Ave, San Pedro, CA 91111, USA",
"AddressDetails": {
"Accuracy" : 8,
 "Country" : {
  "AdministrativeArea" : {
     "AdministrativeAreaName" : "CA",
     "Locality" : {
        "LocalityName" : "San Pedro",
        "PostalCode" : {
           "PostalCodeNumber" : "91111"
        },
        "Thoroughfare" : {
           "ThoroughfareName" : "Washington Ave"
        }
     }
  },
  "CountryName" : "USA",
  "CountryNameCode" : "US"
 }
},
"ExtendedData": {
  "LatLonBox": {
    "north": 37.7026153,
    "south": 37.6999173,
    "east": -122.1393925,
    "west": -122.1420904
  }
},
"Point": {
  "coordinates": [ -122.1407313, 50.7012704, 0 ]
}
} ]
}
  • 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-27T19:20:17+00:00Added an answer on May 27, 2026 at 7:20 pm

    It looks like you’re unclear on how to reach into nested objects in the parsed JSON. I assume you’re using JBJson (formerly Json-Framework) to get that JSONValue category on NSString, yes? If so, it’s parsed the whole deal, you just have to walk it.

    The first helpful this online json visualizer: http://jsonviewer.stack.hu/
    Paste your raw JSON into that to see the whole tree structure of it.

    Then, you should understand your’e going to to get an NSDictionary that has NSDictionaries and NSArrays in its values. So it’s not “id: p1” you’re digging into. If you want those coordinates, the coordinates array is at the path Placemark[0].Point.coordinates.

    It’s going to look more like:

    NSArray *placemarks = [self.jsonArray objectForKey:@"Placemark"];
    NSDictionary *mark = [placemarks objectAtIndex:0];
    NSDictionary *point = [mark objectForKey:@"Point"];
    NSArray *coordinates = [point objectForKey:@"coordinates"];
    

    A clever person who has worked in Obj-c more recently than I might be able to walk that with an keypath or something, but I did it this way to show you the nested objects you’re really navigating here.

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

Sidebar

Related Questions

I am trying to parse JSON response from a httpwebrequest fetch and a little
I'm unsure on the best stack to build a chat application. Currently I'm thinking
I'm trying to show a list of all users but am unsure how to
I've been trying to figure out how to parse textures in directx for two
im parsing a JSON and cant seem to extract an integer. If i do
I am attempting to parse a text (CSS) file using fscanf and pull out
I'm building a grammar to parse Newick trees using ParseKit for a project I'm
I'm trying to dynamically update a table of values using SocketStream. I have a
I am currently trying to write a Treetop grammar to parse Simple Game Format
I'm using Ruby's CSV library to parse some CSV. I have a seemingly well-formed

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.