xmlrpc icon indicating copy to clipboard operation
xmlrpc copied to clipboard

Marshal/Unmarshal string to struct (and vice-versa)

Open smoyer64 opened this issue 4 years ago • 1 comments

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.

smoyer64 avatar Nov 11 '19 17:11 smoyer64

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
}

icholy avatar Jul 03 '20 15:07 icholy