Marshal/Unmarshal string to struct (and vice-versa)
smoyer64 opened this issue · 1 comments
smoyer64 commented
String values should marshal/unmarshal to struct when MarshalText
/UnmarshalText
are implemented. both the encoding/json
and encoding/xml
packages provide this capability so it should be a matter of letting the underlying library do the encoding/decoding.
icholy commented
Can you provide a concrete example of what that would look like? Would MarshalText
return the entire value?
func (t Thing) MarshalText() ([]byte, error) {
return []byte("<value><int>1</int></value>"), nil
}