Report Tool or Give Us Suggestions

YAML to Python POJO Generator

Generate Python dataclass models from YAML structure for config and API typing.

L ading . . .

YAML to Python dataclasses

Structured YAML (mappings and lists) is turned into @dataclass classes with type hints. Nested objects become separate classes; lists become list[…] with element types inferred from the first sample element.

Typing notes

The file starts with from __future__ import annotations so forward references stay simple. Missing or null values map to Any where needed.

Frequently Asked Questions

Does this validate against my real YAML at runtime?

No. It only generates static models. Use pydantic, attrs, or manual parsing to validate production data.

Why empty lists become list[Any]?

With no element sample the element type is unknown. Tighten the type after you know the real structure.

Can I use Pydantic instead?

The output is plain dataclasses for a small stdlib footprint. You can translate fields to Pydantic BaseModel manually or with another generator.