code: func (self *Scheme) runtimeObjectToRawExtensionArray(in *[]Object, out *[]RawExtension, s conversion.Scope) error {
  	src := *in
  	dest := make([]RawExtension, len(src))
  
  	_, outVersion, scheme := self.fromScope(s)
  
  	for i := range src {
  		switch t := src[i].(type) {
  		case *Unknown:
  			// TODO: this should be decoupled from the scheme (since it is JSON specific)
  			dest[i].RawJSON = t.RawJSON
  		case *Unstructured:
  			// TODO: this should be decoupled from the scheme (since it is JSON specific)
  			data, err := json.Marshal(t.Object)
  			if err != nil {
  				return err
  			}
  			dest[i].RawJSON = data
  		default:
  			version := outVersion
  			// if the object exists
  			// this code is try to set the outputVersion, but only if the object has a non-internal group version
  			if inGVK, err := scheme.ObjectKind(src[i]); err == nil && !inGVK.GroupVersion().IsEmpty() {
  				if self.raw.InternalVersions[inGVK.Group] != inGVK.GroupVersion() {
  					version = inGVK.GroupVersion().String()
  				}
  			}
  			data, err := scheme.EncodeToVersion(src[i], version)
  			if err != nil {
  				return err
  			}
  			dest[i].RawJSON = data
  		}
  	}
  	*out = dest
  	return nil
  }
docs: // runtimeObjectToRawExtensionArray takes a list of objects and encodes them as RawExtension in the output version
  // defined by the conversion.Scope. If objects must be encoded to different schema versions than the default, you
  // should encode them yourself with runtime.Unknown, or convert the object prior to invoking conversion. Objects
  // outside of the current scheme must be added as runtime.Unknown.