Sometimes frameworks (like $resource/AngularJS) require an array as a query result, and you can't really have a response like {count:10,items:[...]} in this case I store "count" in responseHeaders.
P. S. Actually you can do that with $resource/AngularJS, but it needs some tweaks.