Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In iOS >= 5 you can parse it without external libraries</p> <pre><code>NSString *filePath = [[NSBundle mainBundle] pathForResource:@"Coordinates" ofType:@"geojson"]; NSData *data = [NSData dataWithContentsOfFile:filePath]; NSError *error; NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&amp;error]; </code></pre> <p>But the content of the file isn't a valid JSON string.</p> <p>If possible change it to something like:</p> <pre><code>{     "shelf1": {         "name": "six.png",         "coordinates": [             [                 14,                 25,                 329,                 138             ],             [                 14,                 185,                 329,                 138             ],             [                 14,                 344,                 158,                 138             ],             [                 185,                 344,                 158,                 138             ],             [                 14,                 94,                 158,                 138             ],             [                 185,                 500,                 158,                 138             ]         ]     } } </code></pre> <p>Then you can access it with:</p> <pre><code>NSDictionary *shelf1 = [json objectForKey:@"shelf1"]; //OR NSArray *coordinates = [[json objectForKey:@"shelf1"] objectForKey:@"coordinates"]; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

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