Implement Custom Marshaler and Unmarshaler
masterYou can customize how types are handled by implementing either the Bytes or Interface variants of the marshaler/unmarshaler interfaces:
BytesMarshaler/BytesUnmarshaler: Behaves likeencoding/json. It returns/accepts[]byte. Note that because indentation matters in YAML, the library must decode the returned bytes to integrate them correctly into the parent container.InterfaceMarshaler/InterfaceUnmarshaler: Behaves likegopkg.in/yaml.v2. This is generally more performant for complex objects because it allows the library to skip an extra decoding step.