// MarshalJSON allows a monitor to be parsed as a JSON object.
965652
func (m Monitor) MarshalJSON() ([]byte, error) {
	type DevicesList struct {
		Serial  SerialDevices  `json:"serial,required"`
		Network NetworkDevices `json:"network,required"`
	}
	type MarshallableMonitor struct {
		Devices DevicesList `json:"devices"`
	}

	return json.Marshal(MarshallableMonitor{
		Devices: DevicesList{Serial: m.serial, Network: m.network},
	})
}
986680
func (t *TimeAPI) MarshalJSON() ([]byte, error) {
	return json.Marshal(t.S.UNIX())
}
504045
func (s Services) MarshalJSON() ([]byte, error) {
	data, err := s.MarshalYAML()
	if err != nil {
		return nil, err
	}
	return json.MarshalIndent(data, "", "  ")
}
454827
func (v Opened) MarshalJSON() ([]byte, error) {
	w := jwriter.Writer{}
	easyjson692db02bEncodeGithubComMailgunMailgunGoEvents5(&w, v)
	return w.Buffer.BuildBytes(), w.Error
}
1050177
func (c *Constant) MarshalJSON() ([]byte, error) {
	buffer := bytes.NewBufferString(fmt.Sprintf("\"%s\"", c))
	return buffer.Bytes(), nil
}
161807
func (s Sample) MarshalJSON() ([]byte, error) {
	v := struct {
		Metric Metric     `json:"metric"`
		Value  SamplePair `json:"value"`
	}{
		Metric: s.Metric,
		Value: SamplePair{
			Timestamp: s.Timestamp,
			Value:     s.Value,
		},
	}

	return json.Marshal(&v)
}
1013565
func (t JSONTime) MarshalJSON() ([]byte, error) {
	ts := t.Time().UnixNano() / 1000
	return []byte(strconv.FormatInt(ts, 10)), nil
}
1036865
func (p Protected) MarshalJSON() ([]byte, error) {
	b, err := json.Marshal(map[string]interface{}(p))
	if err != nil {
		return nil, err
	}
	return EncodeEscape(b), nil
}
387807
func (timestamp Timestamp) MarshalJSON() ([]byte, error) {
	return []byte(time.Time(timestamp).UTC().Format(timestampFormat)), nil
}
39026
func (i *Int32) MarshalJSON() ([]byte, error) {
	if i == nil || !i.Valid {
		return []byte("null"), nil
	}

	return json.Marshal(i.Int32)
}
526125
func (p *PhysicalTableScan) MarshalJSON() ([]byte, error) {
	pushDownInfo, err := json.Marshal(&p.physicalTableSource)
	if err != nil {
		return nil, errors.Trace(err)
	}
	buffer := bytes.NewBufferString("{")
	buffer.WriteString(fmt.Sprintf(
		" \"db\": \"%s\","+
			"\n \"table\": \"%s\","+
			"\n \"desc\": %v,"+
			"\n \"keep order\": %v,"+
			"\n \"push down info\": %s}",
		p.DBName.O, p.Table.Name.O, p.Desc, p.KeepOrder, pushDownInfo))
	return buffer.Bytes(), nil
}
850532
func (v Complained) MarshalJSON() ([]byte, error) {
	w := jwriter.Writer{}
	easyjson692db02bEncodeGithubComMailgunMailgunGoEvents15(&w, v)
	return w.Buffer.BuildBytes(), w.Error
}
238482
func (t Time) MarshalJSON() ([]byte, error) {
	var seconds, nanos int64
	if t.Seconds != nil {
		seconds = *t.Seconds
	}
	if t.Nanos != nil {
		nanos = int64(*t.Nanos)
	}
	return json.Marshal(time.Unix(seconds, nanos))
}
1023916
func (v CBPerson) MarshalJSON() ([]byte, error) {
	w := jwriter.Writer{}
	easyjsonB0500db0EncodeGithubComFrancoispqtGojayBenchmarks1(&w, v)
	return w.Buffer.BuildBytes(), w.Error
}
1354121
func (e *Event) MarshalJSON() ([]byte, error) {
	raw := rawEvent{
		ReplyToken: e.ReplyToken,
		Type:       e.Type,
		Timestamp:  e.Timestamp.Unix()*millisecPerSec + int64(e.Timestamp.Nanosecond())/int64(time.Millisecond),
		Source:     e.Source,
		Postback:   e.Postback,
	}
	if e.Beacon != nil {
		raw.Beacon = &rawBeaconEvent{
			Hwid: e.Beacon.Hwid,
			Type: e.Beacon.Type,
			DM:   hex.EncodeToString(e.Beacon.DeviceMessage),
		}
	}
	if e.AccountLink != nil {
		raw.AccountLink = &rawAccountLinkEvent{
			Result: e.AccountLink.Result,
			Nonce:  e.AccountLink.Nonce,
		}
	}

	switch e.Type {
	case EventTypeMemberJoined:
		raw.Joined = &rawMemberEvent{
			Members: e.Members,
		}
	case EventTypeMemberLeft:
		raw.Left = &rawMemberEvent{
			Members: e.Members,
		}
	case EventTypeThings:
		raw.Things = &Things{
			DeviceID: e.Things.DeviceID,
			Type:     e.Things.Type,
		}
	}

	switch m := e.Message.(type) {
	case *TextMessage:
		raw.Message = &rawEventMessage{
			Type: MessageTypeText,
			ID:   m.ID,
			Text: m.Text,
		}
	case *ImageMessage:
		raw.Message = &rawEventMessage{
			Type: MessageTypeImage,
			ID:   m.ID,
		}
	case *VideoMessage:
		raw.Message = &rawEventMessage{
			Type: MessageTypeVideo,
			ID:   m.ID,
		}
	case *AudioMessage:
		raw.Message = &rawEventMessage{
			Type:     MessageTypeAudio,
			ID:       m.ID,
			Duration: m.Duration,
		}
	case *FileMessage:
		raw.Message = &rawEventMessage{
			Type:     MessageTypeFile,
			ID:       m.ID,
			FileName: m.FileName,
			FileSize: m.FileSize,
		}
	case *LocationMessage:
		raw.Message = &rawEventMessage{
			Type:      MessageTypeLocation,
			ID:        m.ID,
			Title:     m.Title,
			Address:   m.Address,
			Latitude:  m.Latitude,
			Longitude: m.Longitude,
		}
	case *StickerMessage:
		raw.Message = &rawEventMessage{
			Type:      MessageTypeSticker,
			ID:        m.ID,
			PackageID: m.PackageID,
			StickerID: m.StickerID,
		}
	}
	return json.Marshal(&raw)
}
251645
func (args Args) MarshalJSON() ([]byte, error) {
	if len(args.fields) == 0 {
		return []byte{}, nil
	}
	return json.Marshal(args.fields)
}
422181
func (x LogLevel) MarshalJSON() ([]byte, error) {
	// var level string
	var level = FormatLogLevel(x)
	return json.Marshal(level)
}