* Use toJSON only when a middleware returns object