YAML to Go Struct Converter
Paste a YAML document and get Go structs with proper field names, types, and `json:"..."` tags — ready for `encoding/json` or `yaml.v3`.
Last updated: May 27, 2026
Find this tool useful? Support the project to keep it free!
Buy me a coffeeWhat is YAML to Go Struct Converter?
Go projects that consume YAML (Kubernetes operators, Helm-related tools, CI runners) typically declare structs with json or yaml tags and decode the YAML into them. Writing the structs by hand for a large YAML schema is tedious — each field needs an exported name, a Go type, and a tag.
This tool parses YAML to JSON internally, then reuses the JSON-to-Go generator. The output uses `json:"..."` tags by default; if you need YAML-specific tags, replace `json` with `yaml` after generation (both gopkg.in/yaml.v3 and sigs.k8s.io/yaml accept JSON tags, but explicit yaml tags are clearer).
How to Use YAML to Go Struct Converter
Paste a YAML document into the input panel.
Set the root struct name and package name.
Toggle json tags and pointer types for nested structs.
Copy the generated structs into your project.
Common Use Cases
- Bootstrapping Go structs from a Kubernetes manifest or CRD example.
- Generating types for a Go service consuming YAML config.
- Producing model structs for a CI/CD tool.
- Converting a YAML schema example to typed Go structs.
Example Input and Output
A YAML mapping becomes a Go struct with json tags.
name: Alice
active: truepackage main
type Root struct {
Name string `json:"name"`
Active bool `json:"active"`
}Privacy
All YAML parsing and Go generation happen in your browser. No content is sent to a server.
YAML coverage
The internal YAML parser handles the common subset (mappings, sequences, scalars). Anchors, aliases, and explicit tags may not be supported.

