Marshal Go structs to and from YAML using their JSON tags
open sourceMIT AND BSD-3-Clausefree
Forked from ghodss/yaml.
sigs.k8s.io/yaml is an open source Go library from the Kubernetes project for marshalling and unmarshalling YAML. It wraps go-yaml: it converts YAML to JSON and then uses the standard library's json.Marshal and json.Unmarshal, so a struct's existing JSON field tags and custom JSON methods apply to YAML too. It's a permanent fork of ghodss/yaml, maintained under Kubernetes SIG API Machinery.
Problems it solves
- parse YAML into Go structs using their json tags
- read Kubernetes-style YAML config into Go types
- convert YAML to JSON in Go
Features
- marshal and unmarshal YAML with a struct's JSON tags
- reuses custom JSON marshalling methods for YAML
- YAMLToJSON and JSONToYAML conversion
- supports everything go-yaml supports
Limitations
Alternatives
The same job
These do what sigs.k8s.io/yaml does.
- ghodss/yaml Go YAML marshaling that reuses JSON struct tags, by converting YAML to JSON (unmaintained)
