func (t Time) MarshalJSON() ([]byte, error) {
	if t.String() == "0001-01-01 00:00:00" {
		if NullToEmptyStr {
			return []byte(`""`), nil
		}
		return []byte(`null`), nil
	}
	b := make([]byte, 0, len(TmFormat)+2)
	b = append(b, '"')
	b = time.Time(t).AppendFormat(b, TmFormat)
	b = append(b, '"')
	return b, nil
}
MarshalJSON json encode Time.
package jsontime
import (
	"database/sql/driver"
	"fmt"
	"time"
)
type Time time.Time
var NullToEmptyStr bool
const (
	TmFormat = "2006-01-02 15:04:05"
)
func (t *Time) UnmarshalJSON(data []byte) (err error) {
	str := string(data)
	if str == `null` || str == "" || str == `""` {
		return nil
	}
	now, err := time.ParseInLocation(`"`+TmFormat+`"`, str, time.Local)
	*t = Time(now)
	return
}