func (ts *TimestampMillisecond) UnmarshalJSON(data []byte) error {
	var str string
	if err := json.Unmarshal(data, &str); err != nil {
		return err
	}
	if str == "" {
		*ts = TimestampMillisecond{}
		return nil
	}
	ms, err := strconv.ParseInt(str, 10, 64)
	if err != nil {
		return err
	}
	sec := ms / 1e3
	nano := (ms % 1e3) * 1e6
	*ts = TimestampMillisecond(time.Unix(sec, nano))
	return nil
}
UnmarshalJSON implements json.Unmarshaler.

It converts milliseconds since unix epoch into time.
package rmapi
import (
	"encoding/json"
	"strconv"
	"time"
)
type TimestampMillisecond time.Time
func (ts TimestampMillisecond) MarshalJSON() ([]byte, error) {
	t := time.Time(ts)
	if t.IsZero() {
		return []byte("null"), nil
	}
	str := strconv.FormatInt(t.Unix()*1e3+int64(t.Nanosecond())/1e3, 10)
	return json.Marshal(str)
}