YAML to C# Converter
Paste a YAML document and get C# classes with typed properties, optional JSON annotations, and namespace support.
Last updated: May 28, 2026
Find this tool useful? Support the project to keep it free!
Buy me a coffeeWhat is YAML to C# Converter?
This tool converts YAML to a C# class hierarchy. It parses YAML into JSON internally, then generates C# classes that mirror the document structure. Nested mappings become nested classes, sequences become List<T>, and scalar values are typed as string, int, double, or bool.
How to Use YAML to C# Converter
Paste YAML into the input panel.
Set a root class name (optional).
Choose a namespace or leave blank.
Toggle JSON property attributes and nullable types.
Copy the generated C# code.
Common Use Cases
- Generating C# models for a .NET service that deserializes YAML configs.
- Typing Kubernetes or Helm values in a .NET operator.
- Scaffolding model classes before writing YAML serialization code.
- Converting API YAML examples to C# DTOs.
Example Input and Output
A small YAML mapping becomes a C# class.
name: Alice
age: 30
active: truepublic class Root
{
[JsonPropertyName("name")]
public string Name { get; set; }
[JsonPropertyName("age")]
public int Age { get; set; }
[JsonPropertyName("active")]
public bool Active { get; set; }
}Tip
Add System.Text.Json or Newtonsoft.Json using directives when using the generated [JsonPropertyName] attributes.

