Add ability to set response type

Your code always returns array, but i need object.
This can do the job.