Repolode
hadashiA

hadashiA/VYaml

A high-performance, low-allocation YAML 1.2 library for C# focused on .NET and Unity, with source-generated serialization.

Open-source alternative to:YamlDotNet

Stars
481
Forks
41
Open issues
17
Last commit
2 days ago

What is it?

VYaml is a YAML 1.2 implementation written in pure C# for .NET and Unity. It provides a low-level parser and emitter that work directly on UTF-8 bytes, and a high-level serializer that converts YAML to and from user-defined C# types. Serialization code is generated at compile time by a source generator through the [YamlObject] attribute, so the serializer avoids runtime reflection.

The library supports polymorphism through unions identified by YAML tags, by a discriminator key, or by a wrapping key. It also covers renaming keys, naming conventions, required members, default-value omission, and [Flags] enums. A separate VYaml.JsonSchema package generates JSON Schema from C# types so editors can offer completion and validation for hand-written YAML. Native AOT and trimmed builds are supported.

It also handles Unity's non-standard serialized YAML format, where scene files may contain the "stripped" marker on the document start line.

Key features

  • 01Parses and emits YAML 1.2 with a low-allocation UTF-8 based design.
  • 02Serializes and deserializes between YAML and C# types via source generation.
  • 03Supports interface and abstract class unions identified by tags, discriminator keys, or wrapping keys.
  • 04Generates JSON Schema from C# types for editor completion and validation.
  • 05Provides Unity-specific type support and Native AOT / trimming compatibility.

Use cases

  • Loading game or configuration data stored as YAML in Unity projects.
  • Reading and writing YAML config files in .NET services or tools.
  • Parsing large YAML files where allocation and speed matter.
  • Providing schema-based editor validation for hand-written YAML configs.

Quick start

  1. 1

    Install the VYaml package from NuGet

    dotnet add package VYaml
  2. 2

    In Unity, install NuGetForUnity, then install the VYaml package from the NuGet window

Things to know

  • Mainly focused on Unity, and requires Unity 2021.3 or later.
  • YAML 1.2 is only mostly supported.
  • The node tree representation is not yet supported (it is on the roadmap).
  • Enums are serialized only as simple string representations.

In collections

Topics

FAQ

What is VYaml?
A high-performance, low-allocation YAML 1.2 library for C# focused on .NET and Unity, with source-generated serialization. VYaml is a YAML 1.2 implementation written in pure C# for .NET and Unity. It provides a low-level parser and emitter that work directly on UTF-8 bytes, and a high-level serializer that converts YAML to and from user-defined C# types. Serialization code is generated at compile time by a source generator through the [YamlObject] attribute, so the serializer avoids runtime reflection.
Is VYaml free to use? What license does it have?
VYaml is open source under the MIT license. Check the license terms before using it in commercial products.
Is VYaml still maintained?
Actively maintained. The last commit to VYaml was on Nov 5, 2026.
What can I use VYaml for?
Loading game or configuration data stored as YAML in Unity projects. Reading and writing YAML config files in .NET services or tools. Parsing large YAML files where allocation and speed matter. Providing schema-based editor validation for hand-written YAML configs.
How do I install VYaml?
Install the VYaml package from NuGet: dotnet add package VYaml In Unity, install NuGetForUnity, then install the VYaml package from the NuGet window
Where can I get VYaml?
The source code and installation instructions are on GitHub: https://github.com/hadashiA/VYaml

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects