decode a string to object