In order to specify which kind of resource in the JSON payload Nuxeo is returning, we need to include the entity-type inside the content type response header rather than in the JSON itself. (or into a special response header "Nuxeo-Entity-Type)
We can keep it for compatibility (for automation client etc...) inside the body but we need to declare in the response header the entity-type like document or documents to have a more proper semantic http response and a proper unmarshalling on client side:
For instance in Java, you have to unmarshall in a general way the body for then using the proper object to map on it. (after knowing which entity-type it is).
And if the entity-type was the object itself (i.e. "DocumentModel.class") instead of the hardcoded one (i.e. "document") ? In this way we would be able to extend the "business object" feature side.
Content-Type header now returns the nuxeo-entity type as well: application/json; nuxeo-entity=documents