YamlConvert 3.1.0
dotnet add package YamlConvert --version 3.1.0
NuGet\Install-Package YamlConvert -Version 3.1.0
<PackageReference Include="YamlConvert" Version="3.1.0" />
paket add YamlConvert --version 3.1.0
#r "nuget: YamlConvert, 3.1.0"
// Install YamlConvert as a Cake Addin #addin nuget:?package=YamlConvert&version=3.1.0 // Install YamlConvert as a Cake Tool #tool nuget:?package=YamlConvert&version=3.1.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 | Versions 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 | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Newtonsoft.Json (>= 13.0.3)
- YamlDotNet (>= 16.0.0)
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.