Skip to content

Instantly share code, notes, and snippets.

@mamund
Created April 30, 2012 19:18
Show Gist options
  • Save mamund/2561720 to your computer and use it in GitHub Desktop.
Save mamund/2561720 to your computer and use it in GitHub Desktop.
supporting inline collections for collection+json
{ "collection" :
 {
   "version" : "1.0",
   "href" : "http://example.org/posts/",
   "items" : [
     {
       "href" : "http://example.org/posts/1",
       "data" : [
         {"name" : "full-name", "value" : "J. Doe", "prompt" : "Full Name"},
         {"name" : "email", "value" : "[email protected]", "prompt" : "Email"}
       ],
       "links": [
         { "rel": "comments", "href": "http://example.org/comments/1,2,3,4", "length": 4, "inline":true },
         { "rel": "examples", "href": "http://example.org/examples/a,b,c", "length": 3, "inline":true },
         { "rel": "author", "href": "http://example.org/author/mamund"} // assume line===false
       ]
     }
   ],
   "inline": {
     "http://example.org/comments/1,2,3,4": { /* embedded collection+json */ },
     "http://example.org/examples/a,b,c": { /* embedded collection+json */ }
   }
 }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment