// UnmarshalJSON helps unmarshal a Cloud Controller Event response.
483746
func (event *Event) UnmarshalJSON(data []byte) error {
	var ccEvent struct {
		Metadata internal.Metadata `json:"metadata"`
		Entity   struct {
			Type      string                 `json:"type,omitempty"`
			ActorGUID string                 `json:"actor,omitempty"`
			ActorType string                 `json:"actor_type,omitempty"`
			ActorName string                 `json:"actor_name,omitempty"`
			ActeeGUID string                 `json:"actee,omitempty"`
			ActeeType string                 `json:"actee_type,omitempty"`
			ActeeName string                 `json:"actee_name,omitempty"`
			Timestamp *time.Time             `json:"timestamp"`
			Metadata  map[string]interface{} `json:"metadata"`
		} `json:"entity"`
	}

	err := cloudcontroller.DecodeJSON(data, &ccEvent)
	if err != nil {
		return err
	}

	event.GUID = ccEvent.Metadata.GUID
	event.Type = constant.EventType(ccEvent.Entity.Type)
	event.ActorGUID = ccEvent.Entity.ActorGUID
	event.ActorType = ccEvent.Entity.ActorType
	event.ActorName = ccEvent.Entity.ActorName
	event.ActeeGUID = ccEvent.Entity.ActeeGUID
	event.ActeeType = ccEvent.Entity.ActeeType
	event.ActeeName = ccEvent.Entity.ActeeName
	if ccEvent.Entity.Timestamp != nil {
		event.Timestamp = *ccEvent.Entity.Timestamp
	}
	event.Metadata = ccEvent.Entity.Metadata

	return nil
}
332437
func (host *Host) UnmarshalJSON(data []byte) (err error) {
	var s string
	if err = json.Unmarshal(data, &s); err != nil {
		return err
	}

	// Allow empty string
	if s == "" {
		*host = Host{}
		return nil
	}

	var h *Host
	if h, err = ParseHost(s); err != nil {
		return err
	}

	*host = *h
	return nil
}
1310138
func (v *bulkDeleteRequestCommandOp) UnmarshalJSON(data []byte) error {
	r := jlexer.Lexer{Data: data}
	easyjson8092efb6DecodeGithubComOlivereElastic(&r, v)
	return r.Error()
}
209612
func (v *App) UnmarshalJSON(data []byte) error {
	r := jlexer.Lexer{Data: data}
	easyjson633f8c25DecodeGithubComCloudfoundryCommunityFirehoseToSyslogCaching(&r, v)
	return r.Error()
}
1231191
func (s *String) UnmarshalJSON(b []byte) error {
	v := [...]interface{}{&s.Timestamp, &s.Value}
	return json.Unmarshal(b, &v)
}
1244557
func (e *Event) UnmarshalJSON(b []byte) error {
	o := outEvent{}
	err := json.Unmarshal(b, &o)
	if err != nil {
		return err
	}

	v := BaseBody{}
	err = json.Unmarshal(o.Body, &v)
	if err != nil {
		return err
	}

	var body Body
	switch v.Type() {
	case TypeOperationProvisioned:
		body = &OperationProvisioned{}
	case TypeOperationDeprovisioned:
		body = &OperationDeprovisioned{}
	case TypeOperationResized:
		body = &OperationResized{}
	case TypeResourceProjectChanged:
		body = &ResourceProjectChanged{}
	case TypeResourceOwnerChanged:
		body = &ResourceOwnerChanged{}
	case TypeOperationFailed:
		body = &OperationFailed{}
	case TypeResourceMeasuresAdded:
		body = &ResourceMeasuresAdded{}
	case TypeResourceMeasuresFailed:
		body = &ResourceMeasuresFailed{}
	case TypeAccountStatusUpdated:
		body = &AccountStatusUpdated{}
	case TypeAccountUpdated:
		body = &AccountUpdated{}
	default:
		return fmt.Errorf("Unrecognized Operation Type: %s", v.Type())
	}

	err = json.Unmarshal(o.Body, body)
	if err != nil {
		return err
	}

	e.ID = o.ID
	e.StructVersion = o.StructVersion
	e.StructType = o.StructType
	e.Body = body

	return nil
}
88121
func (r *AWSServerlessFunction_Events) UnmarshalJSON(b []byte) error {

	// Unmarshal into interface{} to check it's type
	var typecheck interface{}
	if err := json.Unmarshal(b, &typecheck); err != nil {
		return err
	}

	switch val := typecheck.(type) {

	case string:
		r.String = &val

	case []string:
		r.StringArray = &val

	case map[string]interface{}:
		val = val // This ensures val is used to stop an error

	case []interface{}:

		json.Unmarshal(b, &r.StringArray)

	}

	return nil
}
1176565
func (v *VolumeSnapshotData) UnmarshalJSON(data []byte) error {
	tmp := VolumeSnapshotDataCopy{}
	err := json.Unmarshal(data, &tmp)
	if err != nil {
		return err
	}
	tmp2 := VolumeSnapshotData(tmp)
	*v = tmp2
	return nil
}
897602
func (v *Accepted) UnmarshalJSON(data []byte) error {
	r := jlexer.Lexer{Data: data}
	easyjson692db02bDecodeGithubComMailgunMailgunGoEvents17(&r, v)
	return r.Error()
}
1223434
func (instance *ApplicationInstance) UnmarshalJSON(data []byte) error {
	var ccInstance struct {
		Details string  `json:"details"`
		Since   float64 `json:"since"`
		State   string  `json:"state"`
	}
	err := cloudcontroller.DecodeJSON(data, &ccInstance)
	if err != nil {
		return err
	}

	instance.Details = ccInstance.Details
	instance.State = constant.ApplicationInstanceState(ccInstance.State)
	instance.Since = ccInstance.Since

	return nil
}
99092
func (rc *RequestContext) UnmarshalJSON(data []byte) error {
	var jrc jsonRequestContext
	if err := json.Unmarshal(data, &jrc); err != nil {
		return err
	}

	*rc = *(*RequestContext)(jrc.requestContextAlias)
	rc.Authorizer = jrc.Authorizer

	return nil
}
8434
func (v *Subscriber) UnmarshalJSON(data []byte) error {
	r := jlexer.Lexer{Data: data}
	easyjson639f989aDecodeCodeCloudfoundryOrgGorouterMbus1(&r, v)
	return r.Error()
}
1197964
func (vd *VolumeSnapshotDataList) UnmarshalJSON(data []byte) error {
	tmp := VolumeSnapshotDataListCopy{}
	err := json.Unmarshal(data, &tmp)
	if err != nil {
		return err
	}
	tmp2 := VolumeSnapshotDataList(tmp)
	*vd = tmp2
	return nil
}
763384
func (v *Failed) UnmarshalJSON(data []byte) error {
	r := jlexer.Lexer{Data: data}
	easyjson692db02bDecodeGithubComMailgunMailgunGoEvents12(&r, v)
	return r.Error()
}
319004
func (v *InputAnnotation) UnmarshalJSON(data []byte) error {
	r := jlexer.Lexer{Data: data}
	easyjson3b0ebf6aDecodeGithubComSignalfxGatewayProtocolSignalfxFormat5(&r, v)
	return r.Error()
}
1162891
func (u *Uint64) UnmarshalJSON(data []byte) error {
	if isNull(data) {
		u.Valid = false
		return nil
	}
	if err := json.Unmarshal(data, &u.Uint64); err != nil {
		return err
	}
	u.Valid = true
	return nil
}
416835
func (v *VolumeSnapshot) UnmarshalJSON(data []byte) error {
	tmp := VolumeSnapshotCopy{}
	err := json.Unmarshal(data, &tmp)
	if err != nil {
		return err
	}
	tmp2 := VolumeSnapshot(tmp)
	*v = tmp2
	return nil
}