YamlConvert 2.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package YamlConvert --version 2.0.0                
NuGet\Install-Package YamlConvert -Version 2.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="YamlConvert" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add YamlConvert --version 2.0.0                
#r "nuget: YamlConvert, 2.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install YamlConvert as a Cake Addin
#addin nuget:?package=YamlConvert&version=2.0.0

// Install YamlConvert as a Cake Tool
#tool nuget:?package=YamlConvert&version=2.0.0                

YamlConvert

YamlConvert is a YamlDotNet extension library which makes it trivially easy to serialize objects to/from YAML honoring JSON.NET attributes

Json.Net attributes

If you have been using JSON.NET you probably already use JsonProperty/JsonIgnore annotations to make your serialization just right. Then you think "why not try this YAML thing...and discover that your JObjects blow up and your annotations are ignored.

This library fixes this by creating a object converter for yamldotnet which understands how to read and write JObject/JArray/JValue objects. Not only that, but it honors the JSON.NET attributes you have painstakingly created.

Installation

nuget install YamlConvert

YamlConvert

YamlConvert - exposes SerializeObject() and DeserializeObject() methods which work just like JsonConvert, but with YAML

// to serialize to yaml
var yaml = YamlConvert.SerializeObject(someObject);

// to load your object as a JToken
dynamic obj1 = YamlConvert.DeserializeObject(yaml);

// to load your object as a typed object
var obj2 = YamlConvert.DeserializeObject<MyTypedObject>(yaml);

JTokenYamlConverter

This is a type converter for reading and writing JToken objects. It's automatically used by YamlConvert, but you can add it to your own serializer definition by using .WithTypeConverter(new JTokenYamlConverter())

Example:

var serializer = new SerializerBuilder()
            .WithTypeConverter(new JTokenYamlConverter())
            .Build();
var deserializer = new DeserializerBuilder()
            .WithTypeConverter(new JTokenYamlConverter())
            .Build();
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on YamlConvert:

Package Downloads
Crazor

Experimental library for creating Adaptive Cards.

Crazor.AI

Experimental library for creating Adaptive Cards using ASP.NET Blazor component .Razor templates.

NeverTest

Library allows executing yaml based scenarios.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.1.0 248 11/21/2024
3.0.0 1,981 8/27/2024
2.1.1 54,862 2/18/2022
2.1.0 459 2/18/2022
2.0.0 447 2/15/2022
1.0.1 444 2/15/2022
1.0.0 1,020 12/21/2021