YAML to Dart Converter
Paste a YAML document and get Dart classes with typed fields, optional final modifiers, and fromJson/toJson serialization methods.
Last updated: May 28, 2026
Find this tool useful? Support the project to keep it free!
Buy me a coffeeWhat is YAML to Dart Converter?
This tool converts a YAML document into Dart model classes. It parses YAML to JSON internally, then generates Dart classes with typed fields. Nested YAML mappings become nested Dart classes, sequences become List<T>, and fromJson/toJson factories are generated for easy JSON serialization — common in Flutter apps.
How to Use YAML to Dart Converter
Paste YAML into the input panel.
Set a root class name (optional).
Toggle final fields, nullable types, and fromJson/toJson generation.
Copy the generated Dart classes.
Common Use Cases
- Generating Flutter model classes from a YAML API example.
- Creating Dart models for a config-driven application.
- Scaffolding Dart types before writing YAML parsing code.
- Producing serializable Dart classes from YAML service definitions.
Example Input and Output
A small YAML mapping becomes a Dart class with fromJson/toJson.
name: Alice
age: 30
active: trueclass Root {
final String? name;
final int? age;
final bool? active;
Root({
this.name,
this.age,
this.active,
});
factory Root.fromJson(Map<String, dynamic> json) {
return Root(
name: json['name'] as String?,
age: json['age'] as int?,
active: json['active'] as bool?,
);
}
}Tip
For Flutter projects, consider using code generation packages like json_serializable for production serialization instead of hand-written fromJson/toJson.

