OneYaml 1.2.1
dotnet add package OneYaml --version 1.2.1
NuGet\Install-Package OneYaml -Version 1.2.1
<PackageReference Include="OneYaml" Version="1.2.1" />
<PackageVersion Include="OneYaml" Version="1.2.1" />
<PackageReference Include="OneYaml" />
paket add OneYaml --version 1.2.1
#r "nuget: OneYaml, 1.2.1"
#:package OneYaml@1.2.1
#addin nuget:?package=OneYaml&version=1.2.1
#tool nuget:?package=OneYaml&version=1.2.1
OneYaml
Lossless, comment-preserving editing and a System.Text.Json-style serializer for YAML 1.2, in one .NET package. Both run on one parser, so a typed read and an edit never disagree about what a file means. Pure C#, correct YAML 1.2 by default; nesting, alias expansion and integer size are bounded unless you lift the limits.
How many times faster OneYaml is than the strongest other .NET YAML library on each task (wall-clock time, log scale, higher is better; a task where OneYaml is slower shows as a slower bar):
Full results, with every loss and the method →
Install
dotnet add package OneYaml
Quick start
Change two values in a file, keeping the comment, the block scalar and every other byte as they were; then bind the original text to a record.
using OneYaml;
string src = """
# Build settings
script: |
make build
replicas: 2 # the CI job scales this
""";
using var doc = YamlDocument.Parse(src);
doc.Set("/script", "make build\nmake test\n"); // still a block literal
doc.Root["replicas"] = 3; // only the 2 changes
Console.WriteLine(doc);
// # Build settings
// script: |
// make build
// make test
// replicas: 3 # the CI job scales this
var cfg = YamlSerializer.Deserialize<Config>(src)!;
Console.WriteLine($"{cfg.Replicas} replicas"); // 2 replicas
record Config(int Replicas, string Script);
Documentation
- README: why OneYaml and where to go; stability and supported .NET versions
- Serializer, Editing, Patches, Limits
- Migrating from YamlDotNet or SharpYaml; how OneYaml compares
- Changelog and security policy
Report problems at GitHub issues. Licensed under MIT or Apache-2.0, at your option.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on OneYaml:
| Package | Downloads |
|---|---|
|
OneYaml.Compat.YamlDotNet
A compatibility adapter covering a subset of YamlDotNet's API (serializer builders and representation model), tested against YamlDotNet 18.1.0, running on OneYaml. Every difference is listed. |
|
|
OneYaml.Compat.SharpYaml
A compatibility adapter covering a subset of the SharpYaml serializer API (YamlSerializer, YamlSerializerOptions, attributes), tested against SharpYaml 3.14.0, running on OneYaml. Every difference is listed. |
GitHub repositories
This package is not used by any popular GitHub repositories.