// MarshalJSON conducts the necessary flattening of the Builder struct
// to provide valid Packer template JSON
358961
func (b *Builder) MarshalJSON() ([]byte, error) {
	// Avoid recursion
	type Builder_ Builder
	out, _ := json.Marshal(Builder_(*b))

	var m map[string]json.RawMessage
	_ = json.Unmarshal(out, &m)

	// Flatten Config
	delete(m, "config")
	for k, v := range b.Config {
		out, _ = json.Marshal(v)
		m[k] = out
	}

	return json.Marshal(m)
}
961567
func (p *StaticProperty) MarshalJSON() ([]byte, error) {
	return json.Marshal(map[string]interface{}{
		"key":   p.Key,
		"value": p.Value,
	})
}
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)
}
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
}
706393
func (a *Annotation) MarshalJSON() ([]byte, error) {
	return json.Marshal(&struct {
		Timestamp int64  `json:"timestamp"`
		Value     string `json:"value"`
	}{
		Timestamp: a.Timestamp.Round(time.Microsecond).UnixNano() / 1e3,
		Value:     a.Value,
	})
}
789835
func (r *rawTemplate) MarshalJSON() ([]byte, error) {
	// Avoid recursion
	type rawTemplate_ rawTemplate
	out, _ := json.Marshal(rawTemplate_(*r))

	var m map[string]json.RawMessage
	_ = json.Unmarshal(out, &m)

	// Flatten Comments
	delete(m, "comments")
	for _, comment := range r.Comments {
		for k, v := range comment {
			out, _ = json.Marshal(v)
			m[k] = out
		}
	}

	return json.Marshal(m)
}
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)
}
1163668
func (t *CarouselTemplate) MarshalJSON() ([]byte, error) {
	return json.Marshal(&struct {
		Type             TemplateType         `json:"type"`
		Columns          []*CarouselColumn    `json:"columns"`
		ImageAspectRatio ImageAspectRatioType `json:"imageAspectRatio,omitempty"`
		ImageSize        ImageSizeType        `json:"imageSize,omitempty"`
	}{
		Type:             TemplateTypeCarousel,
		Columns:          t.Columns,
		ImageAspectRatio: t.ImageAspectRatio,
		ImageSize:        t.ImageSize,
	})
}
1166731
func (m *TemplateMessage) MarshalJSON() ([]byte, error) {
	return json.Marshal(&struct {
		Type       MessageType      `json:"type"`
		AltText    string           `json:"altText"`
		Template   Template         `json:"template"`
		QuickReply *QuickReplyItems `json:"quickReply,omitempty"`
	}{
		Type:       MessageTypeTemplate,
		AltText:    m.AltText,
		Template:   m.Template,
		QuickReply: m.quickReplyitems,
	})
}
974680
func (v LargePayload) MarshalJSON() ([]byte, error) {
	w := jwriter.Writer{}
	easyjsonCfe4e5f0EncodeGithubComFrancoispqtGojayBenchmarks(&w, v)
	return w.Buffer.BuildBytes(), w.Error
}
532862
func (v Annotation) MarshalJSON() ([]byte, error) {
	w := jwriter.Writer{}
	easyjson72863a49EncodeGithubComSignalfxGolibTraceFormat3(&w, v)
	return w.Buffer.BuildBytes(), w.Error
}
568110
func (v MediumPayload) MarshalJSON() ([]byte, error) {
	w := jwriter.Writer{}
	easyjsonB0500db0EncodeGithubComFrancoispqtGojayBenchmarks(&w, v)
	return w.Buffer.BuildBytes(), w.Error
}
878515
func (c Config) MarshalJSON() ([]byte, error) {
	m := map[string]interface{}{
		"version":  c.Version,
		"services": c.Services,
	}

	if len(c.Networks) > 0 {
		m["networks"] = c.Networks
	}
	if len(c.Volumes) > 0 {
		m["volumes"] = c.Volumes
	}
	if len(c.Secrets) > 0 {
		m["secrets"] = c.Secrets
	}
	if len(c.Configs) > 0 {
		m["configs"] = c.Configs
	}
	for k, v := range c.Extras {
		m[k] = v
	}
	return json.Marshal(m)
}
1023916
func (v CBPerson) MarshalJSON() ([]byte, error) {
	w := jwriter.Writer{}
	easyjsonB0500db0EncodeGithubComFrancoispqtGojayBenchmarks1(&w, v)
	return w.Buffer.BuildBytes(), w.Error
}
1227031
func (af *aggFunction) MarshalJSON() ([]byte, error) {
	buffer := bytes.NewBufferString(fmt.Sprintf("\"%s\"", af))
	return buffer.Bytes(), nil
}
1036677
func (p *basePlan) MarshalJSON() ([]byte, error) {
	children := make([]string, 0, len(p.children))
	for _, child := range p.children {
		children = append(children, child.GetID())
	}
	childrenStrs, err := json.Marshal(children)
	if err != nil {
		return nil, errors.Trace(err)
	}
	buffer := bytes.NewBufferString("{")
	buffer.WriteString(fmt.Sprintf("\"children\": %s", childrenStrs))
	buffer.WriteString("}")
	return buffer.Bytes(), nil
}
439610
func (c *BubbleContainer) MarshalJSON() ([]byte, error) {
	return json.Marshal(&struct {
		Type      FlexContainerType       `json:"type"`
		Direction FlexBubbleDirectionType `json:"direction,omitempty"`
		Header    *BoxComponent           `json:"header,omitempty"`
		Hero      *ImageComponent         `json:"hero,omitempty"`
		Body      *BoxComponent           `json:"body,omitempty"`
		Footer    *BoxComponent           `json:"footer,omitempty"`
		Styles    *BubbleStyle            `json:"styles,omitempty"`
	}{
		Type:      FlexContainerTypeBubble,
		Direction: c.Direction,
		Header:    c.Header,
		Hero:      c.Hero,
		Body:      c.Body,
		Footer:    c.Footer,
		Styles:    c.Styles,
	})
}