// UnmarshalJSON unmarshals json into a VariableArguments struct, using the `Type`
// field to assign the approriate struct to the `Values` field
9155
func (a *VariableArguments) UnmarshalJSON(data []byte) error {
	type Alias VariableArguments
	aux := struct{ *Alias }{Alias: (*Alias)(a)}

	err := json.Unmarshal(data, &aux)
	if err != nil {
		return err
	}

	// Decode the polymorphic VariableArguments.Values field into the approriate struct
	switch aux.Type {
	case "constant":
		values, ok := aux.Values.([]interface{})
		if !ok {
			return fmt.Errorf("error parsing %v as VariableConstantArguments", aux.Values)
		}

		variableValues := make(VariableConstantValues, len(values))
		for i, v := range values {
			if _, ok := v.(string); !ok {
				return fmt.Errorf("expected variable constant value to be string but received %T", v)
			}
			variableValues[i] = v.(string)
		}

		a.Values = variableValues
	case "map":
		values, ok := aux.Values.(map[string]interface{})
		if !ok {
			return fmt.Errorf("error parsing %v as VariableMapArguments", aux.Values)
		}

		variableValues := VariableMapValues{}
		for k, v := range values {
			if _, ok := v.(string); !ok {
				return fmt.Errorf("expected variable map value to be string but received %T", v)
			}
			variableValues[k] = v.(string)
		}

		a.Values = variableValues
	case "query":
		values, ok := aux.Values.(map[string]interface{})
		if !ok {
			return fmt.Errorf("error parsing %v as VariableQueryArguments", aux.Values)
		}

		variableValues := VariableQueryValues{}

		query, prs := values["query"]
		if !prs {
			return fmt.Errorf("\"query\" key not present in VariableQueryArguments")
		}
		if _, ok := query.(string); !ok {
			return fmt.Errorf("expected \"query\" to be string but received %T", query)
		}

		language, prs := values["language"]
		if !prs {
			return fmt.Errorf("\"language\" key not present in VariableQueryArguments")
		}
		if _, ok := language.(string); !ok {
			return fmt.Errorf("expected \"language\" to be string but received %T", language)
		}

		variableValues.Query = query.(string)
		variableValues.Language = language.(string)
		a.Values = variableValues
	default:
		return fmt.Errorf("unknown VariableArguments type %s", aux.Type)
	}

	return nil
}
1188998
func (ua *Uint64Array) UnmarshalJSON(data []byte) error {
	if isNull(data) {
		ua.Valid = false
		return nil
	}
	if data == nil {
		ua.Uint64Array, ua.Valid = nil, false
		return nil
	}
	ua.Valid = true
	return json.Unmarshal(data, &ua.Uint64Array)
}
1347772
func (t *JSONTime) UnmarshalJSON(buf []byte) error {
	s := bytes.Trim(buf, `"`)

	v, err := strconv.Atoi(string(s))
	if err != nil {
		return err
	}

	*t = JSONTime(int64(v))
	return nil
}
536587
func (t *Type) UnmarshalJSON(b []byte) error {
	var aux string
	err := json.Unmarshal(b, &aux)
	if err != nil {
		return err
	}

	switch aux {
	case roundRobinName:
		rr := RoundRobin
		t = &rr // nolint: ineffassign
	}

	return nil
}
167317
func (v *Stats) UnmarshalJSON(data []byte) error {
	r := jlexer.Lexer{Data: data}
	easyjsonE3ab7953DecodeGithubComCloudfoundryCommunityFirehoseToSyslogStats(&r, v)
	return r.Error()
}
259031
func (sa *StringArray) UnmarshalJSON(data []byte) error {
	if isNull(data) {
		sa.Valid = false
		return nil
	}
	if data == nil {
		sa.StringArray, sa.Valid = nil, false
		return nil
	}

	sa.Valid = true

	return json.Unmarshal(data, &sa.StringArray)
}
962110
func (s *Set) UnmarshalJSON(data []byte) error {
	var vv []string
	if err := json.Unmarshal(data, &vv); err != nil {
		return err
	}

	*s = *Use(vv...)
	return nil
}
1120272
func (self *StructTypeDef) UnmarshalJSON(b []byte) error {
	var m rawStructTypeDef
	err := json.Unmarshal(b, &m)
	if err == nil {
		o := StructTypeDef(m)
		*self = *((&o).Init())
		err = self.Validate()
	}
	return err
}
74776
func (s *JSONMapItem) UnmarshalJSON(data []byte) error {
	l := jlexer.Lexer{Data: data}
	s.UnmarshalEasyJSON(&l)
	return l.Error()
}
928347
func (v *Stored) UnmarshalJSON(data []byte) error {
	r := jlexer.Lexer{Data: data}
	easyjson692db02bDecodeGithubComMailgunMailgunGoEvents1(&r, v)
	return r.Error()
}
1164123
func (j *Json) UnmarshalJSON(p []byte) error {
	dec := json.NewDecoder(bytes.NewBuffer(p))
	dec.UseNumber()
	return dec.Decode(&j.data)
}
970751
func (b *Bytes) UnmarshalJSON(input []byte) error {
	if !isString(input) {
		return errNonString(bytesT)
	}
	return wrapTypeError(b.UnmarshalText(input[1:len(input)-1]), bytesT)
}
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
}
1260140
func (n *ACIdentifier) UnmarshalJSON(data []byte) error {
	var s string
	if err := json.Unmarshal(data, &s); err != nil {
		return err
	}
	nn, err := NewACIdentifier(s)
	if err != nil {
		return err
	}
	*n = *nn
	return nil
}
735403
func (j *Json) UnmarshalJSON(p []byte) error {
	return json.Unmarshal(p, &j.data)
}
824684
func (bj *BinaryJSON) UnmarshalJSON(data []byte) error {
	var decoder = json.NewDecoder(bytes.NewReader(data))
	decoder.UseNumber()
	var in interface{}
	err := decoder.Decode(&in)
	if err != nil {
		return errors.Trace(err)
	}
	buf := make([]byte, 0, len(data))
	var typeCode TypeCode
	typeCode, buf, err = appendBinary(buf, in)
	if err != nil {
		return errors.Trace(err)
	}
	bj.TypeCode = typeCode
	bj.Value = buf
	return nil
}
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
}