Yaml To Go Pojo Generator
Convert YAML documents into nested Go structs in the browser for configs and APIs.
What Is YAML to Go POJO Generator?
YAML to Go POJO Generator converts YAML configuration or API samples into nested Go struct types.
Same idea as JSON-to-Go helpers: paste YAML, get struct definitions you can refine for
yaml.v3 or yaml.v2 unmarshaling.
How It Works
The tool parses YAML in your browser, normalizes the root value (arrays are wrapped as an items field),
then walks objects and arrays to emit one struct per nested object. Scalars map to string,
bool, int64, float64, or interface{} when the type is unclear.
YAML timestamps become string fields because Go time layout is ambiguous from structure alone.
How to Use It
- Paste YAML or load the built-in sample from the editor toolbar.
- Set the root struct name for the top-level type.
- Copy or download the generated
models.gosnippet.
Frequently Asked Questions
Which YAML documents are used if I paste multiple documents?
All documents are read in order; the first non-null document drives code generation. Put your primary mapping or sequence first in the file.
Does output include struct tags for YAML?
No. You get field names and types only. Add yaml:"..." tags yourself to match your keys
and naming rules.
What if the root is a scalar or only null?
The generator expects a mapping or sequence at the root. Scalars and empty files show a short comment instead of structs.
Are empty YAML arrays supported?
Yes, but with no element sample they become []interface{}, just like empty JSON arrays.
Related tools
Your recent visits