Encode []byte as base64 string (to be consistent with stdlib JSON)
Author: johanbrandhorstCreated Dec 20, 2016Updated Mar 16, 2025
The standard library JSON module automatically converts any []byte struct members to base64 encoded strings when marshalling (see https://golang.org/pkg/encoding/json/#Marshal). The YAML library does not, and instead outputs a []byte as an array of bytes, like so:
bytes:
- 54
- 32I think it would be nice for go-yaml to be consistent with the go standard library behaviour for JSON.
Source: go-yaml/yaml