check value encoding and parse object for return

There exists a bug, that if valueEncoding is `json` that the object does not get parsed and throws an error when trying to return a non Buffer or string through the http server. This resolves that problem. 

Added unit tests to cover.