More than once, I've found myself wanting to do something like this:

package main

import (

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.SetTag("json2") // no such thing as this here

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?


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 
For more options, visit

Reply via email to