// MarshalJSON serializes the given schema as JSON.
772693
func (s *Record) MarshalJSON() ([]byte, error) {
	m := make(map[string]interface{})

	m["type"] = "record"

	if len(s.Name) > 0 {
		m["name"] = s.Name
	}

	if len(s.Namespace) > 0 {
		m["namespace"] = s.Namespace
	}

	if len(s.Doc) > 0 {
		m["doc"] = s.Doc
	}
	if len(s.Aliases) > 0 {
		m["aliases"] = s.Aliases
	}

	m["fields"] = s.Fields
	for k, v := range s.Properties {
		m[k] = v
	}
	return json.Marshal(m)
}
304827
func (r Raw) MarshalJSON() ([]byte, error) {
	if r == nil {
		return []byte("null"), nil
	}
	return r, nil
}
1050177
func (c *Constant) MarshalJSON() ([]byte, error) {
	buffer := bytes.NewBufferString(fmt.Sprintf("\"%s\"", c))
	return buffer.Bytes(), nil
}
1061427
func (o *Object) MarshalJSON() ([]byte, error) {
	ctx := _builtinJSON_stringifyContext{
		r: o.runtime,
	}
	ex := o.runtime.vm.try(func() {
		if !ctx.do(o) {
			ctx.buf.WriteString("null")
		}
	})
	if ex != nil {
		return nil, ex
	}
	return ctx.buf.Bytes(), nil
}
532862
func (v Annotation) MarshalJSON() ([]byte, error) {
	w := jwriter.Writer{}
	easyjson72863a49EncodeGithubComSignalfxGolibTraceFormat3(&w, v)
	return w.Buffer.BuildBytes(), w.Error
}
1133745
func (c *ConfigTree) MarshalJSON() ([]byte, error) {
	return json.Marshal(&struct {
		Root *node `json:"root"`
	}{
		Root: c.root,
	})
}
49826
func (cas ColumnAttrSet) MarshalJSON() ([]byte, error) {
	if cas.Key != "" {
		return json.Marshal(struct {
			Key   string                 `json:"key,omitempty"`
			Attrs map[string]interface{} `json:"attrs,omitempty"`
		}{
			Key:   cas.Key,
			Attrs: cas.Attrs,
		})
	}
	return json.Marshal(struct {
		ID    uint64                 `json:"id"`
		Attrs map[string]interface{} `json:"attrs,omitempty"`
	}{
		ID:    cas.ID,
		Attrs: cas.Attrs,
	})
}
1162532
func (c *FillerComponent) MarshalJSON() ([]byte, error) {
	return json.Marshal(&struct {
		Type FlexComponentType `json:"type"`
	}{
		Type: FlexComponentTypeFiller,
	})
}
132157
func (s *RecursiveSchema) MarshalJSON() ([]byte, error) {
	return []byte(fmt.Sprintf(`"%s"`, s.Actual.GetName())), nil
}
899549
func (v ClientInfo) MarshalJSON() ([]byte, error) {
	w := jwriter.Writer{}
	easyjsonCce3d1beEncodeGithubComMailgunMailgunGoEvents8(&w, v)
	return w.Buffer.BuildBytes(), w.Error
}
1337070
func (ins *Insert) MarshalJSON() ([]byte, error) {
	var tname string
	if ins.Table != nil {
		tname = ins.Table.Name.String()
	}
	marshalInsert := struct {
		Opcode               InsertOpcode
		Keyspace             *vindexes.Keyspace   `json:",omitempty"`
		Query                string               `json:",omitempty"`
		Values               []sqltypes.PlanValue `json:",omitempty"`
		Table                string               `json:",omitempty"`
		Generate             *Generate            `json:",omitempty"`
		Prefix               string               `json:",omitempty"`
		Mid                  []string             `json:",omitempty"`
		Suffix               string               `json:",omitempty"`
		MultiShardAutocommit bool                 `json:",omitempty"`
		QueryTimeout         int                  `json:",omitempty"`
	}{
		Opcode:               ins.Opcode,
		Keyspace:             ins.Keyspace,
		Query:                ins.Query,
		Values:               ins.VindexValues,
		Table:                tname,
		Generate:             ins.Generate,
		Prefix:               ins.Prefix,
		Mid:                  ins.Mid,
		Suffix:               ins.Suffix,
		MultiShardAutocommit: ins.MultiShardAutocommit,
		QueryTimeout:         ins.QueryTimeout,
	}
	return jsonutil.MarshalNoEscape(marshalInsert)
}
1026747
func (r *Row) MarshalJSON() ([]byte, error) {
	var o struct {
		Attrs   map[string]interface{} `json:"attrs"`
		Columns []uint64               `json:"columns"`
		Keys    []string               `json:"keys,omitempty"`
	}
	o.Columns = r.Columns()
	o.Keys = r.Keys

	o.Attrs = r.Attrs
	if o.Attrs == nil {
		o.Attrs = make(map[string]interface{})
	}

	return json.Marshal(&o)
}
115194
func (sa *StringArray) MarshalJSON() ([]byte, error) {
	if sa == nil || !sa.Valid {
		return []byte("null"), nil
	}

	return json.Marshal(sa.StringArray)
}
81219
func (fr FieldRow) MarshalJSON() ([]byte, error) {
	if fr.RowKey != "" {
		return json.Marshal(struct {
			Field  string `json:"field"`
			RowKey string `json:"rowKey"`
		}{
			Field:  fr.Field,
			RowKey: fr.RowKey,
		})
	}
	return json.Marshal(struct {
		Field string `json:"field"`
		RowID uint64 `json:"rowID"`
	}{
		Field: fr.Field,
		RowID: fr.RowID,
	})
}
863293
func (m *marshalableError) MarshalJSON() ([]byte, error) {
	return json.Marshal(m.err.Error())
}
933910
func (s *Field) MarshalJSON() ([]byte, error) {
	m := make(map[string]interface{})
	if s.Type != nil {
		m["type"] = s.Type
	}
	if len(s.Name) > 0 {
		m["name"] = s.Name
	}

	if s.Type.Type() == gv.Null || (s.Type.Type() == gv.Union && s.Type.(*gv.UnionSchema).Types[0].Type() == gv.Null) || s.Default != nil {
		m["default"] = s.Default
	}
	if len(s.Doc) > 0 {
		m["doc"] = s.Doc
	}

	for k, v := range s.Properties {
		m[k] = v
	}
	return json.Marshal(m)
}
413851
func (s *Sources) MarshalJSON() ([]byte, error) {
	srcs := make([]Source, len(s.Sources))
	for i, src := range s.Sources {
		srcs[i] = Source{src}
	}
	return json.Marshal(srcs)
}