I have this type:
type S struct {
a string 'json:"a" xml:"a"'
b int 'json:"b" xml:"b"'
c time.Time 'json:"c" xml:"c"'
}
But neither JSON nor XML works:
s := S{a: "Olá", b: 42, c: time.Now()}
jsonTexto, err := json.Marshal(s)
fmt.Printf("json: %s %v\n", jsonTexto, err)
// json: {} <nil>
xmlTexto, err := xml.Marshal(s)
fmt.Printf("xml : %s %v\n", xmlTexto, err)
// xml : <S></S> <nil>
Why?