Skip to content

Commit 31c9159

Browse files
author
Josh Holtz
committed
Merge branch 'master' of github.com:joshdholtz/jsonapi-ios
2 parents 205afba + cf5a81b commit 31c9159

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,17 @@ for (JSONAPIResource *post in posts) {
106106

107107
NSString *json = @"{\"posts\":[{\"id\":1,\"name\":\"A post!\",\"links\":{\"author\":9}},{\"id\":2,\"name\":\"Another post!\",\"links\":{\"author\":10}}],\"linked\":{\"people\":[{\"id\":9,\"name\":\"Josh Holtz\"},{\"id\":10,\"name\":\"Bandit the Cat\"}]}}";
108108

109+
// Links "author" resource to "people" linked resources
109110
[JSONAPIResourceLinker link:@"author" toLinkedType:@"people"];
111+
112+
//
110113
[JSONAPIResourceModeler useResource:[PeopleResource class] toLinkedType:@"people"];
111114
[JSONAPIResourceModeler useResource:[PostResource class] toLinkedType:@"posts"];
112115

113116
// Parses JSON string into JSONAPI object
114117
JSONAPI *jsonApi = [JSONAPI JSONAPIWithString:json];
115118

119+
// Gets posts from JSONAPI that will be an array of PostResource objects
116120
NSArray *posts = [jsonApi resourcesForKey:@"posts"];
117121

118122
// Parsing using JSONAPI and modeled resources (PostResource, PeopleResource, CommentResource

0 commit comments

Comments
 (0)