I don't think this would let us unmarshal to different types dependent on the Type field of the parent struct. 

> On Jun 15, 2013, at 14:27, Will Norris <notifications@github.com> wrote:
> 
> In github/events.go:
> 
> > +
> > +// Event represents a GitHub event.
> > +type Event struct {
> > +	Type       string          `json:"type,omitempty"`
> > +	Public     bool            `json:"public"`
> > +	RawPayload json.RawMessage `json:"payload,omitempty"`
> > +	Repo       *Repository     `json:"repo,omitempty"`
> > +	Actor      User            `json:"actor,omitempty"`
> > +	Org        *Organization   `json:"org,omitempty"`
> > +	CreatedAt  *time.Time      `json:"created_at,omitempty"`
> > +	ID         string          `json:"id,omitempty"`
> > +}
> > +
> > +// Payload returns the parsed event payload. For recognized event types
> > +// (PushEvent), a value of the corresponding struct type will be returned.
> > +func (e *Event) Payload() (payload interface{}) {
> (that's not actually why Google+ returns HTML in the content field)
> 
> Another approach would be to implement the json.Marshaler interface, and do this type-specific unmarshalling inside of a custom UnmarshalJSON function. That should allow for:
> 
> type Event struct {
>   ...
>   Payload interface{} `json:"payload,omit_empty"`
> }
> —
> Reply to this email directly or view it on GitHub.