diff --git a/template.go b/template.go index f937a6f..36bec89 100644 --- a/template.go +++ b/template.go @@ -42,6 +42,7 @@ func init() { } } +// MarshalJSON is generated. func (r {{$typename}}) MarshalJSON() ([]byte, error) { if s, ok := interface{}(r).(fmt.Stringer); ok { return json.Marshal(s.String()) @@ -53,6 +54,7 @@ func (r {{$typename}}) MarshalJSON() ([]byte, error) { return json.Marshal(s) } +// UnmarshalJSON is generated. func (r *{{$typename}}) UnmarshalJSON(data []byte) error { var s string if err := json.Unmarshal(data, &s); err != nil {