Im having difficulties to unmarshal json content in golang.
One of the fields in my object contains xml content and occasionally it will fail, claiming messages such as: invalid character '\x..' in string literal
I understand that this is as a result of control characters in my xml, but dont know how to handle it. I store my documents in mongoosejs and save the xml field as type String My struct Im trying to deserialize to is declared this way:
type A struct {
Xml []byte `json:"xml"`
}
Unmarshaling is done the following way:
var xml A
err := json.Unmarshal(content, &xml)