Note that there are some explanatory texts on larger screens.

plurals
  1. POJSONModel used with Objects/Dictionaries
    primarykey
    data
    text
    <p>Ive been working with JSONModel, the tutorials are making sense. They are parsing JSON contain an array with multiple indexes. </p> <p><em><strong>I wanted to make sure JSONModel allowed to be used with say this dataset: <a href="https://gist.github.com/ryancoughlin/8043604" rel="nofollow">https://gist.github.com/ryancoughlin/8043604</a></em></strong></p> <p><code>tide</code> is not an array correct? But there is <code>tide.tideSummary</code> - which contains array of tide data across multiple days.</p> <p><em><strong>AllTide.h</em></strong></p> <pre><code>#import "JSONModelLib.h" #import "Tide.h" @interface AllTide : JSONModel @property (strong,nonatomic) NSDictionary&lt;Tide&gt; *tide; @end </code></pre> <p><em><strong>Tide.h</em></strong></p> <pre><code>#import "JSONModelLib.h" #import "TideSummaryStats.h" @protocol Tide @end @interface Tide : JSONModel @property (nonatomic, strong) NSArray&lt;TideSummaryStats&gt; *tideSummaryStats; @end </code></pre> <p><em><strong>TideSummaryStats.h</em></strong></p> <pre><code>#import "JSONModelLib.h" @protocol TideSummaryStats @end @interface TideSummaryStats : JSONModel @property (nonatomic, strong) NSString *maxheight; @property (nonatomic, strong) NSString *minheight; @end </code></pre> <p><em><strong>TideDetailViewController</em></strong> - Displays a single location (detail view) vs a list of multiple locations </p> <pre><code>@interface TideDetailViewController () { AllTide *_objTide; } @end @implementation TideDetailViewController - (void)viewDidAppear:(BOOL)animated { NSString *locationQueryURL = @"http://api.wunderground.com/api/xxxxx/tide/geolookup/q/43.5263,-70.4975.json"; //fetch the feed _objTide = [[AllTide alloc] initFromURLWithString:locationQueryURL completion:^(JSONModel *model, JSONModelError *err) { NSLog(@"Tides: %@", _objTide.tide); }]; } </code></pre> <p>Been going through several JSONModel tutorials and it makes sense, I think I am having trouble where my JSON format differs from the tutorials. Again, where my <code>tide</code> does not return an array. </p> <p>Would this be a good case to utilize JSONModel keymapper? </p> <p>Any ideas? Let me know if I can provide anything else. Been diving around for some guidance, but a bit stuck. Thanks in advance!</p>
    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.
 

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