code: func (s *Serializer) Encode(obj runtime.Object, w io.Writer) error {
  	if s.options.Yaml {
  		json, err := caseSensitiveJsonIterator.Marshal(obj)
  		if err != nil {
  			return err
  		}
  		data, err := yaml.JSONToYAML(json)
  		if err != nil {
  			return err
  		}
  		_, err = w.Write(data)
  		return err
  	}
  
  	if s.options.Pretty {
  		data, err := caseSensitiveJsonIterator.MarshalIndent(obj, "", "  ")
  		if err != nil {
  			return err
  		}
  		_, err = w.Write(data)
  		return err
  	}
  	encoder := json.NewEncoder(w)
  	return encoder.Encode(obj)
  }
docs: // Encode serializes the provided object to the given writer.