I was wondering if it is allowed to have more _embed elements inside _embed elements in JSON, or if the idea is to only have one level?
See example of normal HAL:
{
"_links": {
"self": { "href": "/orders" },
"curies": [{ "name": "ea", "href": "http://example.com/docs/rels/{rel}", "templated": true }],
"next": { "href": "/orders?page=2" },
"ea:find": {
"href": "/orders{?id}",
"templated": true
},
"ea:admin": [{
"href": "/admins/2",
"title": "Fred"
}, {
"href": "/admins/5",
"title": "Kate"
}]
},
"currentlyProcessing": 14,
"shippedToday": 20,
"_embedded": {
"ea:order": [{
"_links": {
"self": { "href": "/orders/123" },
"ea:basket": { "href": "/baskets/98712" },
"ea:customer": { "href": "/customers/7809" }
},
"total": 30.00,
"currency": "USD",
"status": "shipped"
}, {
"_links": {
"self": { "href": "/orders/124" },
"ea:basket": { "href": "/baskets/97213" },
"ea:customer": { "href": "/customers/12369" }
},
"total": 20.00,
"currency": "USD",
"status": "processing"
}]
}
}
and what the question is about (notice that the second embed is a child of the first one):
{
"_links" : {
"self" : {
"href" : "http://localhost:8090/fs/rest/roles/roleDefinition=Z1407031312513158080GIVMZ"
}
},
"_embedded" : {
"roles" : [ {
"_links" : {
"self" : {
"href" : "http://localhost:8090/fs/rest/roles/Z1407031312513168080XCAKL"
}
},
"id" : "Z1407031312513168080XCAKL",
"_embedded" : {
"roleDefinition" : {
"_links" : {
"self" : {
"href" : "http://localhost:8090/fs/rest/roledefinitions/Z1407031312513158080GIVMZ"
(rest ommitted)
Myself I am reading the documentation at http://stateless.co/hal_specification.html as that an embedded resource is the same as a normal resource and therefore it can again contain embedded resources?