Okay - let us look into sources of admin on rest (file admin-on-rest/src/util/fetch.js) we are intrested in fetchJson method.
That method return fetch promise, in which it try to parse json in that code:
try {
json = JSON.parse(body);
} catch (e) {
// not json, no big deal
}
and then it returns that: return { status, headers, body, json };
But we have body in result and may reuse it or we may use parsed object in json
For your example we may do so (some code missed):
const httpClient = (url, options = {}) => {
if (!options.headers) {
options.headers = new Headers({ Accept: 'application/json' });
}
options.withCredentials = true;
return fetchUtils.fetchJson(url, options).then(({status, headers, body, json}) => {
json = json['results'] ? json['results'] : json;
return {status, headers, body, json};
});
}
So we just overrwrited json object by collection from 'results' in your schema in that line:
json = json['results'] ? json['results'] : json;
Now you may use that client in Admin
<Admin restClient={restClient}>
...
</Admin>
WARNING!!! That will affect to ALL requests of Admin. But you may add additional parameter. If you do not want to use json = json['results'] ? json['results'] : json;
you may add additional parameter or check in method fetch