When generating a Json HAL with a list of two or more embedded resources (like orders example), the library returns an array of embedded objects:
{ "_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 } }, "currentlyProcessing": 14, "shippedToday": 20, "_embedded": { "ea:order": [ { "_links": { "self": { "href": "/orders/123" }, "ea:basket": { "href": "/baskets/98712" }, "ea:customer": { "href": "/customers/7809" } }, "total": 30.0, "currency": "USD", "status": "shipped" }, { "_links": { "self": { "href": "/orders/124" }, "ea:basket": { "href": "/baskets/97213" }, "ea:customer": { "href": "/customers/12369" } }, "total": 20.0, "currency": "USD", "status": "processing" } ] } }
but when the list has only one element, the library returns an embedded object instead of an array with only one element:
{ "_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 } }, "currentlyProcessing": 14, "shippedToday": 20, "_embedded": { "ea:order": { "_links": { "self": { "href": "/orders/123" }, "ea:basket": { "href": "/baskets/98712" }, "ea:customer": { "href": "/customers/7809" } }, "total": 30.0, "currency": "USD", "status": "shipped" } } }
I think it sholud return an array with one order, to be consistent with the previous result. ΒΏIs there any way to force the API to generate an array with one object instead?
Those Json Hal examples were generated using then Example test.
Thanks in advance!