More than once, I've found myself wanting to do something like this:
package main
import (
"encoding/json"
"os"
)
type Cake struct {
Muffin string `json:"muffin" json2:"muffin"`
Pie string `json:"pie" json2:"-"`
Tuna string `json:"tuna" json2:"eel"`
}
func main() {
c := Cake{"a", "b", "c"}
j := json.NewEncoder(os.Stdout)
j.Encode(c)
j.SetTag("json2") // no such thing as this here
j.Encode(c)
}
where I've got a struct that I sometimes want to express in json one way
and sometimes another.
Is there a sensible existing way to do that? Would this be a useful update
to the lib?
thanks,
-reed
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.