mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 04:33:26 +00:00
Use stdlib json encoder for yaml and pretty-json marshaling
This commit is contained in:
parent
04f747d09f
commit
a166f887f6
@ -303,7 +303,7 @@ func (s *Serializer) Encode(obj runtime.Object, w io.Writer) error {
|
|||||||
|
|
||||||
func (s *Serializer) doEncode(obj runtime.Object, w io.Writer) error {
|
func (s *Serializer) doEncode(obj runtime.Object, w io.Writer) error {
|
||||||
if s.options.Yaml {
|
if s.options.Yaml {
|
||||||
json, err := caseSensitiveJSONIterator.Marshal(obj)
|
json, err := json.Marshal(obj)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -316,7 +316,7 @@ func (s *Serializer) doEncode(obj runtime.Object, w io.Writer) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if s.options.Pretty {
|
if s.options.Pretty {
|
||||||
data, err := caseSensitiveJSONIterator.MarshalIndent(obj, "", " ")
|
data, err := json.MarshalIndent(obj, "", " ")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user