Encode and Decode objects without making typos