// MarshalJSON returns a JSON representation of the Histogram.
// Note that sum of all buckets may not be equal to the total temporarily,
// because Add() increments bucket and total with two atomic operations.
354203
func (h *Histogram) MarshalJSON() ([]byte, error) {
	b := bytes.NewBuffer(make([]byte, 0, 4096))
	fmt.Fprintf(b, "{")
	totalCount := int64(0)
	for i, label := range h.labels {
		totalCount += h.buckets[i].Get()
		fmt.Fprintf(b, "\"%v\": %v, ", label, totalCount)
	}
	fmt.Fprintf(b, "\"%s\": %v, ", h.countLabel, totalCount)
	fmt.Fprintf(b, "\"%s\": %v", h.totalLabel, h.total.Get())
	fmt.Fprintf(b, "}")
	return b.Bytes(), nil
}
1007075
func (v CBGravatar) MarshalJSON() ([]byte, error) {
	w := jwriter.Writer{}
	easyjsonB0500db0EncodeGithubComFrancoispqtGojayBenchmarks3(&w, v)
	return w.Buffer.BuildBytes(), w.Error
}
564982
func (aSpace *addrSpace) MarshalJSON() ([]byte, error) {
	aSpace.Lock()
	defer aSpace.Unlock()

	m := map[string]interface{}{
		"Scope": string(aSpace.scope),
	}

	if aSpace.subnets != nil {
		s := map[string]*PoolData{}
		for k, v := range aSpace.subnets {
			s[k.String()] = v
		}
		m["Subnets"] = s
	}

	return json.Marshal(m)
}
113600
func (c *Constant) MarshalJSON() ([]byte, error) {
	return []byte(fmt.Sprintf("\"%s\"", c)), nil
}
1161852
func (sds SerialDevices) MarshalJSON() ([]byte, error) {
	temp := make([]*SerialDevice, len(sds))
	i := 0
	for _, item := range sds {
		temp[i] = item
		i++
	}
	return json.Marshal(temp)
}
1125318
func (l *Limit) MarshalJSON() ([]byte, error) {
	marshalLimit := struct {
		Opcode string
		Count  sqltypes.PlanValue
		Offset sqltypes.PlanValue
		Input  Primitive
	}{
		Opcode: "Limit",
		Count:  l.Count,
		Offset: l.Offset,
		Input:  l.Input,
	}
	return json.Marshal(marshalLimit)
}
501918
func (a *aggContainer) MarshalJSON() ([]byte, error) {
	root := map[string]interface{}{
		a.Type: a.Aggregation,
	}

	if len(a.Aggs) > 0 {
		root["aggs"] = a.Aggs
	}

	return json.Marshal(root)
}
486285
func (v Stored) MarshalJSON() ([]byte, error) {
	w := jwriter.Writer{}
	easyjson692db02bEncodeGithubComMailgunMailgunGoEvents1(&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
}
986680
func (t *TimeAPI) MarshalJSON() ([]byte, error) {
	return json.Marshal(t.S.UNIX())
}
585321
func (s *MapSchema) MarshalJSON() ([]byte, error) {
	return json.Marshal(struct {
		Type   string `json:"type,omitempty"`
		Values Schema `json:"values,omitempty"`
	}{
		Type:   "map",
		Values: s.Values,
	})
}
304827
func (r Raw) MarshalJSON() ([]byte, error) {
	if r == nil {
		return []byte("null"), nil
	}
	return r, nil
}
547750
func (f *Float32) MarshalJSON() ([]byte, error) {
	if f == nil || !f.Valid {
		return []byte("null"), nil
	}

	return json.Marshal(f.Float32)
}
323622
func (t String) MarshalJSON() ([]byte, error) {
	return json.Marshal(map[string]interface{}{
		"type": t.typeMarker(),
	})
}
1010656
func (i Image) MarshalJSON() ([]byte, error) {
	gi := &struct {
		Title string `json:"title"`
		URL   string `json:"url"`
		Link  string `json:"link"`
	}{
		Title: i.Title,
		URL:   i.URL,
		Link:  i.Link,
	}
	return json.Marshal(gi)
}
995464
func marshalJSON(obj runtime.Object) ([]byte, error) {
	j, err := kopscodecs.ToVersionedJSON(obj)
	if err != nil {
		return nil, fmt.Errorf("error marshaling json: %v", err)
	}
	return j, nil
}
215954
func (n *NullFloat64) MarshalJSON() ([]byte, error) {
	if !n.Valid {
		return nullString, nil
	}

	return json.Marshal(n.Float64)
}