How to use the Element API endpoint without wrapping it in data object By default the Element API plugin all endpoints in a data object like this:

{ "data": [ { "key" : "value", "key2": "value2" } ]}


But i don't want to wrap this in the data object but like this:

{ "key" : "value", "key2": "value2" }
Use the config setting 'first' =&gt; true and wrap the endpoint in a function

like this:

'api/link' =&gt; function() {
    return [
        'elementType' =&gt; 'Entry',
        'first' =&gt; true,
        'criteria' =&gt; ['section' =&gt; 'mysecton'],
        'paginate' =&gt; false,
        'transformer' =&gt; function(EntryModel $entry) {
            return $something;
        }
    ];
}