code: func (tv *TaskVolume) UnmarshalJSON(b []byte) error {
  	// Format: {name: volumeName, host: HostVolume, dockerVolumeConfiguration {}}
  	intermediate := make(map[string]json.RawMessage)
  	if err := json.Unmarshal(b, &intermediate); err != nil {
  		return err
  	}
  	name, ok := intermediate["name"]
  	if !ok {
  		return errors.New("invalid Volume; must include a name")
  	}
  	if err := json.Unmarshal(name, &tv.Name); err != nil {
  		return err
  	}
  
  	volumeType, ok := intermediate["type"]
  	if !ok {
  		volumeType = []byte(`"host"`)
  		seelog.Infof("Unmarshal task volume: volume type not specified, default to host")
  	}
  	if err := json.Unmarshal(volumeType, &tv.Type); err != nil {
  		return err
  	}
  
  	switch tv.Type {
  	case HostVolumeType:
  		return tv.unmarshalHostVolume(intermediate["host"])
  	case DockerVolumeType:
  		return tv.unmarshalDockerVolume(intermediate["dockerVolumeConfiguration"])
  	default:
  		return errors.Errorf("invalid Volume: type must be docker or host, got %q", tv.Type)
  	}
  }
docs: // UnmarshalJSON for TaskVolume determines the name and volume type, and
  // unmarshals it into the appropriate HostVolume fulfilling interfaces