I have a fairly basic problem with the JSONModel. Let's say I have the following JSON:
{"items": [
{
"id": 1,
"title": "Bla",
"category": 1
}
]}
and this one:
{"categories": [
{
"id": 1,
"name": "Category"
}
]}
Now the easiest thing would be to put the categories inside the items and have JSONModel just use that. But there might be hundreds of items which share just a few categories, and the categories have several attributes like description, URLs and stuff, and that would blow up the items JSON.
How would I combine them in the best way using JSONModel (or might another library be better)?
My models currently look like this:
@interface Item : JSONModel
@property (assign, nonatomic) int id;
@property (strong, nonatomic) NSString* title;
@property (strong, nonatomic) Category* category;
@end
@interface Category : JSONModel
@property (assign, nonatomic) int id;
@property (strong, nonatomic) NSString* name;
@end