check value encoding and parse object for return