Why would you do it as middleware? This would mean two things:
1) The middleware will have to do lots of nasty isinstance/other type checking.
2) You break the contract of what a view is - a view is a callable
returning a response. Your 'view' functions will just be random
functions returning arbitrary objects, which may or may not be
translated into a response by middleware. Hacky.
Instead, simply subclass HttpResponse, and make it do what you want it
to do. As an example, as your specified use case was to simplify
generating JSON responses, I give you JSONResponse:
http://djangosnippets.org/snippets/154/
Cheers
Tom