// MarshalJSON implements encoding/json.Marshaler.
//
// We use a shorthand notation so that we don't waste space in JSON.
185863
func (a Authority) MarshalJSON() ([]byte, error) {
	switch a {
	case AsAnonymous:
		return asAnonymousJSON, nil
	case AsService:
		return asServiceJSON, nil
	case AsUser:
		return asUserJSON, nil
	default:
		return nil, errors.Reason("unknown authority: %v", a).Err()
	}
}
306401
func (that *JSONNode) MarshalJSON() ([]byte, error) {
	var ret []byte
	var err error
	switch that.t {
	case TypeMap:
		ret, err = json.Marshal(that.m)
	case TypeArray:
		ret, err = json.Marshal(that.a)
	case TypeValue:
		ret, err = json.Marshal(that.v)
	default:
		ret, err = json.Marshal(nil)
	}
	if err != nil {
		return nil, err
	}
	return ret, err
}
14221
func (sf *ScalarFunction) MarshalJSON() ([]byte, error) {
	buffer := bytes.NewBufferString(fmt.Sprintf("\"%s\"", sf))
	return buffer.Bytes(), nil
}
304827
func (r Raw) MarshalJSON() ([]byte, error) {
	if r == nil {
		return []byte("null"), nil
	}
	return r, nil
}
609770
func (jt Time) MarshalJSON() ([]byte, error) {
	return json.Marshal(jt.UTC().Format(time.RFC3339Nano))
}
517043
func (e *Error) MarshalJSON() (result []byte, err error) {
	ee := errEncode{
		Code: e.Code,
		Msg:  e.Msg,
		Op:   e.Op,
	}
	if e.Err != nil {
		if _, ok := e.Err.(*Error); ok {
			_, err := e.Err.(*Error).MarshalJSON()
			if err != nil {
				return result, err
			}
			ee.Err = e.Err
		} else {
			ee.Err = e.Err.Error()
		}
	}
	return json.Marshal(ee)
}
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))
}
645043
func (key Key) MarshalJSON() ([]byte, error) {
	if !key.IsValid() {
		return nil, fmt.Errorf("unknown key %v", key)
	}

	return json.Marshal(string(key))
}
957573
func (t T) MarshalJSON() ([]byte, error) {
	params := map[string]interface{}{
		"from": t.From,
	}
	if t.To != "" {
		params["to"] = t.To
	}
	if t.Gas > 0 {
		params["gas"] = IntToHex(t.Gas)
	}
	if t.GasPrice != nil {
		params["gasPrice"] = BigToHex(*t.GasPrice)
	}
	if t.Value != nil {
		params["value"] = BigToHex(*t.Value)
	}
	if t.Data != "" {
		params["data"] = t.Data
	}
	if t.Nonce > 0 {
		params["nonce"] = IntToHex(t.Nonce)
	}

	return json.Marshal(params)
}
1259330
func (j JSONText) MarshalJSON() ([]byte, error) {
	if j == nil {
		return []byte(`null`), nil
	}
	return j, nil
}
1222215
func (v Uint64) MarshalJSON() ([]byte, error) {
	w := jwriter.Writer{}
	v.MarshalEasyJSON(&w)
	return w.Buffer.BuildBytes(), w.Error
}
918180
func (v Failed) MarshalJSON() ([]byte, error) {
	w := jwriter.Writer{}
	easyjson692db02bEncodeGithubComMailgunMailgunGoEvents12(&w, v)
	return w.Buffer.BuildBytes(), w.Error
}
478804
func (e JSONError) MarshalJSON() ([]byte, error) {
	if e.error == nil {
		return []byte("null"), nil
	}
	return json.Marshal(e.Error())
}
545903
func (r Response) MarshalJSON() ([]byte, error) {
	return marshalJSON(_Response(r), r.Extensions)
}
242660
func (u UUID) MarshalJSON() ([]byte, error) {
	return []byte(fmt.Sprintf("\"%s\"", u.String())), nil
}
879542
func (o Operation) MarshalJSON() ([]byte, error) {
	return marshalJSON(_Operation(o), o.Extensions)
}