// MarshalJSON is part of json.Marshaler interface.
359829
func (p Policy) MarshalJSON() ([]byte, error) {
	// We have to use *json.RawMessage instead of json.RawMessage because
	// otherwise json reflection magic gets confused and serializes
	// json.RawMessage as []byte. See http://play.golang.org/p/iid7Xthp-_.
	fields := make(map[string]*json.RawMessage, len(p.UnrecognizedFields)+2)
	for k, v := range p.UnrecognizedFields {
		fields[k] = v
	}

	blob, err := json.Marshal(p.Bindings)
	if err != nil {
		return nil, err
	}
	bindings := json.RawMessage(blob)
	fields["bindings"] = &bindings

	blob, err = json.Marshal(p.Etag)
	if err != nil {
		return nil, err
	}
	etag := json.RawMessage(blob)
	fields["etag"] = &etag

	return json.Marshal(fields)
}
1209696
func (guid GUID) MarshalJSON() (marshaled []byte, err error) {
	buf := bytes.Buffer{}

	_, err = buf.WriteRune('"')
	buf.WriteString(guid.String())
	buf.WriteRune('"')

	marshaled = buf.Bytes()
	return
}
478804
func (e JSONError) MarshalJSON() ([]byte, error) {
	if e.error == nil {
		return []byte("null"), nil
	}
	return json.Marshal(e.Error())
}
1259330
func (j JSONText) MarshalJSON() ([]byte, error) {
	if j == nil {
		return []byte(`null`), nil
	}
	return j, nil
}
1023916
func (v CBPerson) MarshalJSON() ([]byte, error) {
	w := jwriter.Writer{}
	easyjsonB0500db0EncodeGithubComFrancoispqtGojayBenchmarks1(&w, v)
	return w.Buffer.BuildBytes(), w.Error
}
22305
func (v Accepted) MarshalJSON() ([]byte, error) {
	w := jwriter.Writer{}
	easyjson692db02bEncodeGithubComMailgunMailgunGoEvents17(&w, v)
	return w.Buffer.BuildBytes(), w.Error
}
832110
func (m Type) MarshalJSON() ([]byte, error) {
	type Alias Type
	return json.Marshal(&struct {
		Type   string `json:"type"`
		String string `json:"string"`
		Alias
	}{
		Type:   m.Type(),
		String: m.String(),
		Alias:  (Alias)(m),
	})
}
1013565
func (t JSONTime) MarshalJSON() ([]byte, error) {
	ts := t.Time().UnixNano() / 1000
	return []byte(strconv.FormatInt(ts, 10)), nil
}
442697
func (e *goof) MarshalJSON() ([]byte, error) {

	if len(e.Fields()) == 0 {
		return json.Marshal(e.msg)
	}

	m := e.Fields()

	if e.includeMsgInJSON && e.msg != "" {
		m["msg"] = e.msg
	}

	return json.Marshal(m)
}
1343879
func (re Unknown) MarshalJSON() ([]byte, error) {
	if re.RawJSON == nil {
		return []byte("null"), nil
	}
	return re.RawJSON, nil
}
131007
func (arr Array) MarshalJSON() ([]byte, error) {
	if len(arr) == 0 {
		return json.Marshal([]interface{}{})
	}
	return json.Marshal([]*Term(arr))
}
1007075
func (v CBGravatar) MarshalJSON() ([]byte, error) {
	w := jwriter.Writer{}
	easyjsonB0500db0EncodeGithubComFrancoispqtGojayBenchmarks3(&w, v)
	return w.Buffer.BuildBytes(), w.Error
}
14221
func (sf *ScalarFunction) MarshalJSON() ([]byte, error) {
	buffer := bytes.NewBufferString(fmt.Sprintf("\"%s\"", sf))
	return buffer.Bytes(), nil
}
1357593
func (t *Tag) MarshalJSON() ([]byte, error) {
	return json.Marshal([2]string{t.Key, t.Value})
}
299368
func (sf *ScalarFunction) MarshalJSON() ([]byte, error) {
	return []byte(fmt.Sprintf("\"%s\"", sf)), nil
}
839425
func (n NullInt64) MarshalJSON() ([]byte, error) {
	if n.Valid {
		return json.Marshal(n.Int64)
	}
	return nullString, nil
}
548109
func (b Buffer) MarshalJSON() ([]byte, error) {
	v, err := b.Base64Encode()
	if err != nil {
		return nil, errors.Wrap(err, "failed to encode to base64")
	}
	return json.Marshal(string(v))
}