Created
July 7, 2012 14:56
-
-
Save kevinswiber/3066768 to your computer and use it in GitHub Desktop.
JSON Siren vs. HAL Representations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"_links": { | |
"self": { "href": "/orders" }, | |
"next": { "href": "/orders?page=2" }, | |
"find": { "href": "/orders{?id}", "templated": true } | |
}, | |
"_embedded": { | |
"orders": [{ | |
"_links": { | |
"self": { "href": "/orders/123" }, | |
"basket": { "href": "/baskets/98712" }, | |
"customer": { "href": "/customers/7809" } | |
}, | |
"total": 30.00, | |
"currency": "USD", | |
"status": "shipped", | |
},{ | |
"_links": { | |
"self": { "href": "/orders/124" }, | |
"basket": { "href": "/baskets/97213" }, | |
"customer": { "href": "/customers/12369" } | |
}, | |
"total": 20.00, | |
"currency": "USD", | |
"status": "processing" | |
}] | |
}, | |
"currentlyProcessing": 14, | |
"shippedToday": 20 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"class": "orders", | |
"properties": { | |
"currentlyProcessing": 14, | |
"shippedToday": 20 | |
}, | |
"entities": [ | |
{ | |
"class": "order list-item", | |
"rel": "order", | |
"properties": { | |
"total": 30.00, | |
"currency": "USD", | |
"status": "shipped" | |
}, | |
"entities": [ | |
{ "rel": "basket", "href": "/baskets/98712" }, | |
{ "rel": "customer", "href": "/customers/7809" } | |
], | |
"links": [{ "rel": "self", "href": "/orders/123" }] | |
}, | |
{ | |
"class": "order list-item", | |
"rel": "order", | |
"properties": { | |
"total": 20.00, | |
"currency": "USD", | |
"status": "processing" | |
}, | |
"entities": [ | |
{ "rel": "basket", "href": "/baskets/98713" }, | |
{ "rel": "customer", "href": "/customers/12369" } | |
], | |
"links": [{ "rel": "self", "href": "/orders/124" }] | |
} | |
], | |
"actions": [{ | |
"class": "find-order", | |
"href": "/orders", | |
"fields": [{ "name": "id", "type": "number" }] | |
}], | |
"links": [ | |
{ "rel": "self", "href": "/orders" }, | |
{ "rel": "next", "href": "/orders?page=2" } | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Anyone know which json standard has become most popular? I'm writing a bunch of json schema for various multimedia apps but standardization among units is lacking. Will probably go with something closer to Siren.
You may find this useful and/or interesting: http://json-schema.org/latest/json-schema-core.html