Skip to content

Instantly share code, notes, and snippets.

@mikekelly
Created October 25, 2011 13:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mikekelly/1312666 to your computer and use it in GitHub Desktop.
Save mikekelly/1312666 to your computer and use it in GitHub Desktop.
{
"_links": {
"self": { "href": "/todo-list" },
"search": { "href": "/todo-list/search;{searchterm}" },
"description": { "href": "/todo-list/description" }
},
"_embedded": {
"item": [
{
"_links": {
"self": { "href" : "http://example.com/tasks/126"},
"next": { "href": "http://example.org/todos/make-some-tea" },
"attachment": { "href": "http://home.com/tasks/126/attachment/1" }
},
"title": "Find Mug",
"details": "Find the mug which can be said to be mine."
},
{
"_links": {
"self": { "href": "http://example.org/todos/make-some-tea" },
"prev": { "href": "http://example.com/tasks/126" }
},
"title": "Make tea",
"details": "For make drinking goodly tea that is green."
}
],
"owner": {
"_links": {
"self": { "href": "http://example.com/mike" },
"friend": { "href": "http://example.com/mamund" }
},
"name": "Mike",
"age": 36
}
},
"created_at": "2010-01-16",
"updated_at": "2010-02-21",
"summary": "An example list"
}
var list = getTodoListResource();
list.summary //= "An example list"
list._links.search.href //= "/todo-list/search;{searchterm}"
list._embedded.item[0].title //= "Find Mug"
list._embedded.item[0]._links.attachment.href //= "http://home.com/tasks/126/attachment/1"
list._embedded.owner.name //= "Mike"
list._embedded.owner._links.friend.href //= "http://example.com/mamund"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment