Generate code for serialization/deserialization for simple cases.