SBJson Parsing : How to drill down?
<p>I think I need some clarification on how to drill down to JSON values when using SBJson.</p>

<p>Here is a link to some sample JSON I need to parse.
<a href="https://api.foursquare.com/v2/venues/search?ll=40.7,-74&amp;client_id=5EN0WTZZXNLZ3ONGVYBJFVPNPACK21B0NWS4C2R02MRFJOGG&amp;client_secret=UHD0NEHNQMQZZWRJ4X51DBQNWENP0D0YHG3WFVWJ24VJHAOZ&amp;radius=4828&amp;v=20120601" rel="nofollow">https://api.foursquare.com/v2/venues/search?ll=40.7,-74&amp;client_id=5EN0WTZZXNLZ3ONGVYBJFVPNPACK21B0NWS4C2R02MRFJOGG&amp;client_secret=UHD0NEHNQMQZZWRJ4X51DBQNWENP0D0YHG3WFVWJ24VJHAOZ&amp;radius=4828&amp;v=20120601</a></p>

<p>If I look at the parsed JSON I am looking for location records. My problem is nothing is getting brought in. So, my question is how can I get at the location records?</p>

<p>Code follows.</p>

<pre><code>- (NSString *)stringWithUrl:(NSURL *)url
{
    NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url
                                                cachePolicy:NSURLRequestReloadIgnoringLocalCacheData
                                            timeoutInterval:30];
    // Fetch the JSON response
    NSData *urlData;
    NSURLResponse *response;
    NSError *error;

    // Make synchronous request
    urlData = [NSURLConnection sendSynchronousRequest:urlRequest
                                    returningResponse:&amp;response
                                                error:&amp;error];

    // Construct a String around the Data from the response
    return [[NSString alloc] initWithData:urlData encoding:NSUTF8StringEncoding];
}

- (id) objectWithUrl:(NSURL *)url
{

    SBJsonParser *jsonParser = [[SBJsonParser new] autorelease];
    NSString *jsonString = [self stringWithUrl:url];

    // Parse the JSON into an Object
    return [jsonParser objectWithString:jsonString error:NULL];

}

- (void) downloadJSONFeed 
{

    //set up query
    NSString *lat  = [NSString stringWithFormat:@"%f", ad.locationManager.location.coordinate.latitude]; 
    NSString *lon = [NSString stringWithFormat:@"%f", ad.locationManager.location.coordinate.longitude];
    NSString *postValues = [NSString stringWithFormat:@"https://api.foursquare.com/v2/venues/search?ll=%@,%@&amp;client_id=%@&amp;client_secret=%@&amp;radius=4828&amp;v=20120601",lat, lon, @"5EN0WTZZXNLZ3ONGVYBJFVPNPACK21B0NWS4C2R02MRFJOGG", @"EHNQMQZZWRJ4X51DBQNWENP0D0YHG3WFVWJ24VJHAOZ"];


    //get server response
    id response = [self objectWithUrl:[NSURL URLWithString:postValues]];
    NSDictionary *location = [response objectForKey:@"location"];

    //array for json data
    NSMutableArray *jsonData = [[NSMutableArray alloc] init];


    for (NSDictionary *dict in location)
    {
        Bathroom *bathroom = [[[Bathroom alloc] init] autorelease];
        bathroom.name = [dict objectForKey:@"name"];
        bathroom.street = [dict objectForKey:@"address"];
        bathroom.city = [dict objectForKey:@"city"];
        bathroom.state = [dict objectForKey:@"state"];
        bathroom.postal = [dict objectForKey:@"postalCode"];        
        bathroom.country = [dict objectForKey:@"country"];        
        [jsonData addObject:bathroom];
    } 

    //release dictionary
    //[dictionary release];


    //now sort array by distance
    NSSortDescriptor *sortDescriptor;
    sortDescriptor = [[[NSSortDescriptor alloc] initWithKey:@"name"                                                  ascending:YES] autorelease];
    NSArray *sortDescriptors = [NSArray arrayWithObject:sortDescriptor];
    NSArray *sortedArray;
    sortedArray = [jsonData sortedArrayUsingDescriptors:sortDescriptors];
    //dataArray = [[NSMutableArray alloc] init];

    //add objects to data array
    [dataArray addObjectsFromArray:sortedArray];


    //release json data
    [jsonData release];

}    
</code></pre>
