Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You need to read that into an <code>NSDictionary</code> with either <code>NSJSONSerialization</code> (only available in iOS 5 and later) or another JSON framework (I recommend TouchJSON - <a href="https://github.com/TouchCode/TouchJSON" rel="nofollow">https://github.com/TouchCode/TouchJSON</a>).</p> <p>Here are examples:</p> <p>NSJSONSerialization:</p> <pre><code>NSString *jsonString = &lt;JSON_STRING&gt;; NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding]; NSError *error = nil; NSDictionary *dictionary = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&amp;error]; </code></pre> <p>TouchJSON:</p> <pre><code>NSString *jsonString = &lt;JSON_STRING&gt;; NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding]; NSError *error = nil; NSDictionary *dictionary = [[CJSONDeserializer deserializer] deserializeAsDictionary:jsonData error:&amp;error]; </code></pre> <p>Once you have the dictionary you can then extract the information you want. In your case it looks like you want to grab the <code>data</code> which is an array of objects. I assume you then want to show something about those objects in a table. So here's the start of that code to get you going and then you should be able to figure out the rest:</p> <pre><code>NSArray *data = [dictionary objectForKey:@"data"]; // Then for each data object, you can get at say its `locname' attribute to show in a cell like so NSString *locname = [[data objectAtIndex:i] objectForKey:@"locname"]; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload