func (n *NullDuration) UnmarshalJSON(data []byte) error {
	if bytes.Equal(data, []byte("null")) {
		*n = NullDuration{}
		return nil
	}

	var res time.Duration

	err := json.Unmarshal(data, &res)
	if err == nil {
		*n = NullDuration{Duration: res, Valid: true}
		return nil
	}

	var res2 struct {
		Duration time.Duration `json:"duration"`
		Valid    bool          `json:"valid"`
	}
	err = json.Unmarshal(data, &res2)
	if err == nil {
		*n = NullDuration{Duration: res2.Duration, Valid: res2.Valid}
		return nil
	}
	return err
}
// UnmarshalJSON - unmarshaller for json
unmarshaller for json
// UnmarshalJSON - unmarshaller for json
func (n *NullDuration) UnmarshalJSON(data []byte) error {
	if bytes.Equal(data, []byte("null")) {
		*n = NullDuration{}
		return nil
	}
	var res time.Duration
	err := json.Unmarshal(data, &res)
	if err == nil {
		*n = NullDuration{Duration: res, Valid: true}
		return nil
	}
	var res2 struct {
		Duration time.Duration `json:"duration"`
		Valid    bool          `json:"valid"`
	}
	err = json.Unmarshal(data, &res2)
	if err == nil {
		*n = NullDuration{Duration: res2.Duration, Valid: res2.Valid}
		return nil
	}
	return err
}
func ( n * NullDuration ) UnmarshalJSON ( data [ ] byte ) error { if bytes . Equal ( data , [ ] byte ( " " ) ) { * n = NullDuration { } return nil } var res time . Duration err := json . Unmarshal ( data , & res ) if err == nil { * n = NullDuration { Duration : res , Valid : true } return nil } var res2 struct { Duration time . Duration `json:"duration"` Valid bool `json:"valid"` } err = json . Unmarshal ( data , & res2 ) if err == nil { * n = NullDuration { Duration : res2 . Duration , Valid : res2 . Valid } return nil } return err }
unmarshaller for json
unmarshaller for json