agent/api/task/taskvolume.go
func (tv *TaskVolume) MarshalJSON() ([]byte, error) {
	result := make(map[string]interface{})

	if len(tv.Type) == 0 {
		tv.Type = HostVolumeType
	}

	result["name"] = tv.Name
	result["type"] = tv.Type

	switch tv.Type {
	case DockerVolumeType:
		result["dockerVolumeConfiguration"] = tv.Volume
	case HostVolumeType:
		result["host"] = tv.Volume
	default:
		return nil, errors.Errorf("unrecognized volume type: %q", tv.Type)
	}

	return json.Marshal(result)
}
func (tv *TaskVolume) MarshalJSON() ([]byte, error) {
	result := make(map[string]interface{})

	if len(tv.Type) == 0 {
		tv.Type = HostVolumeType
	}

	result["name"] = tv.Name
	result["type"] = tv.Type

	switch tv.Type {
	case DockerVolumeType:
		result["dockerVolumeConfiguration"] = tv.Volume
	case HostVolumeType:
		result["host"] = tv.Volume
	default:
		return nil, errors.Errorf("unrecognized volume type: %q", tv.Type)
	}

	return json.Marshal(result)
}
// MarshalJSON overrides the logic for JSON-encoding a  TaskVolume object