// MarshalJSON is generated so itemCategory satisfies json.Marshaler.
972843
func (r itemCategory) MarshalJSON() ([]byte, error) {
	if s, ok := interface{}(r).(fmt.Stringer); ok {
		return json.Marshal(s.String())
	}
	s, ok := _itemCategoryValueToName[r]
	if !ok {
		return nil, fmt.Errorf("invalid itemCategory: %d", r)
	}
	return json.Marshal(s)
}
39026
func (i *Int32) MarshalJSON() ([]byte, error) {
	if i == nil || !i.Valid {
		return []byte("null"), nil
	}

	return json.Marshal(i.Int32)
}
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),
	})
}
1001001
func (c *Client) MarshalJSON() ([]byte, error) {
	b, err := json.Marshal(struct {
		Config  Config   `json:"config"`
		Cluster *Cluster `json:"cluster"`
	}{
		Config:  c.Config,
		Cluster: c.Cluster,
	})

	if err != nil {
		return nil, err
	}

	return b, nil
}
403674
func (fc *FeatureCollection) MarshalJSON() ([]byte, error) {
	gfc := &geojsonFeatureCollection{
		Type:     "FeatureCollection",
		Features: fc.Features,
	}
	if gfc.Features == nil {
		gfc.Features = []*Feature{}
	}
	return json.Marshal(gfc)
}
243634
func (c *SeparatorComponent) MarshalJSON() ([]byte, error) {
	return json.Marshal(&struct {
		Type   FlexComponentType       `json:"type"`
		Margin FlexComponentMarginType `json:"margin,omitempty"`
		Color  string                  `json:"color,omitempty"`
	}{
		Type:   FlexComponentTypeSeparator,
		Margin: c.Margin,
		Color:  c.Color,
	})
}
1137036
func (s JSONMapSlice) MarshalJSON() ([]byte, error) {
	w := &jwriter.Writer{Flags: jwriter.NilMapAsEmpty | jwriter.NilSliceAsEmpty}
	s.MarshalEasyJSON(w)
	return w.BuildBytes()
}
1212123
func (fc FeatureCollection) MarshalJSON() ([]byte, error) {
	type tempFC FeatureCollection

	c := tempFC{
		Type:     featureCollection,
		BBox:     fc.BBox,
		Features: fc.Features,
	}

	if c.Features == nil {
		c.Features = []*Feature{}
	}
	return json.Marshal(c)
}
1133745
func (c *ConfigTree) MarshalJSON() ([]byte, error) {
	return json.Marshal(&struct {
		Root *node `json:"root"`
	}{
		Root: c.root,
	})
}
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
}
712226
func (i Item) MarshalJSON() ([]byte, error) {
	var creator string
	if i.Modules.DublinCore.Creator != "" {
		creator = i.Modules.DublinCore.Creator
	}

	type author struct {
		Name  string `json:"name"`
		Email string `json:"email"`
	}
	a := author{
		Name: creator,
	}
	var authors []author
	if a.Name != "" {
		authors = append(authors, a)
	}

	var date string
	if i.Modules.DublinCore.Date != "" {
		date = i.Modules.DublinCore.Date
	}

	var updated string
	if i.Modules.DublinCore.Modified != "" {
		updated = i.Modules.DublinCore.Modified
	}

	gi := &struct {
		Title       string   `json:"title"`
		Link        string   `json:"link"`
		Description string   `json:"description"`
		PubDate     string   `json:"pubdate"`
		Updated     string   `json:"updated"`
		Authors     []author `json:"authors"`
	}{
		Title:       i.Title,
		Link:        i.Link,
		Description: i.Description,
		PubDate:     date,
		Updated:     updated,
		Authors:     authors,
	}
	return json.Marshal(gi)
}
488682
func (s *SourceNetwork) MarshalJSON() ([]byte, error) {
	if s == nil {
		return []byte(""), nil
	}

	list := []string(*s)
	if len(list) == 0 || (len(list) == 1 && list[0] == "") {
		return []byte(`""`), nil
	}

	return json.Marshal(list)
}
129280
func (l *Link) MarshalJSON() ([]byte, error) {
	if l.Meta == nil {
		return json.Marshal(l.HREF)
	}
	// Create a sub-type here so when we call Marshal below, we don't recursively
	// call this function over and over
	type MarshalLink Link
	return json.Marshal(MarshalLink(*l))
}
180061
func (c *DataContainer) MarshalJSON() ([]byte, error) {
	if c.DataArray != nil {
		return json.Marshal(c.DataArray)
	}

	return json.Marshal(c.DataObject)
}
304827
func (r Raw) MarshalJSON() ([]byte, error) {
	if r == nil {
		return []byte("null"), nil
	}
	return r, nil
}
1101929
func (s Strings) MarshalJSON() ([]byte, error) {
	if len(s) == 1 {
		return json.Marshal(s[0])
	}
	return json.Marshal([]string(s))
}
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
}