MultiFormatDataConverter 0.2.4

This package has a SemVer 2.0.0 package version: 0.2.4+build.20250714203131.d7bd0a6.
dotnet add package MultiFormatDataConverter --version 0.2.4
                    
NuGet\Install-Package MultiFormatDataConverter -Version 0.2.4
                    
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="MultiFormatDataConverter" Version="0.2.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MultiFormatDataConverter" Version="0.2.4" />
                    
Directory.Packages.props
<PackageReference Include="MultiFormatDataConverter" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MultiFormatDataConverter --version 0.2.4
                    
#r "nuget: MultiFormatDataConverter, 0.2.4"
                    
#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.
#:package MultiFormatDataConverter@0.2.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MultiFormatDataConverter&version=0.2.4
                    
Install as a Cake Addin
#tool nuget:?package=MultiFormatDataConverter&version=0.2.4
                    
Install as a Cake Tool

MultiFormatDataConverter

A versatile .NET library for converting data between JSON, YAML, and XML formats. This library provides a comprehensive set of extension methods to seamlessly convert between different data representation formats.

Installation

Install the package via NuGet:

dotnet add package MultiFormatDataConverter

Features

  • Convert between JSON, YAML, and XML with simple, intuitive extension methods
  • Support for various object types in each format:
    • JSON: JsonNode, JsonObject, JsonArray, JsonDocument
    • XML: XmlDocument, XDocument
    • YAML: YamlStream
  • Cross-platform compatibility
  • AOT-compatible
  • Comprehensive XML documentation
  • .NET 6.0+ support

Usage Examples

Converting between XML and JSON

// Convert from XML to JSON
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml("<root><item>value</item></root>");
JsonNode jsonNode = xmlDoc.ToJsonNode();

// Convert from JSON to XML
JsonObject jsonObject = new JsonObject { ["property"] = "value" };
XmlDocument convertedXml = jsonObject.ToXmlDocument();

Converting between JSON and YAML

// Convert JSON to YAML
JsonObject jsonObject = new JsonObject { ["name"] = "John", ["age"] = 30 };
YamlStream yamlStream = jsonObject.ToYamlStream();

// Convert JSON document to YAML
JsonDocument jsonDocument = JsonDocument.Parse("{\"items\": [1, 2, 3]}");
YamlStream yamlFromDoc = jsonDocument.ToYamlStream();

Converting between YAML and XML

// First convert YAML to JSON, then to XML
YamlStream yamlStream = new YamlStream();
using (var reader = new StringReader("key: value"))
{
    yamlStream.Load(reader);
}
JsonObject? jsonObject = yamlStream.ToJsonObject();
XmlDocument xmlDoc = jsonObject.ToXmlDocument();

API Overview

The library provides three main static classes:

  • XmlConverter: Convert to/from XML formats (XmlDocument, XDocument)
  • JsonConverter: Convert to/from JSON formats (JsonNode, JsonObject, JsonArray, JsonDocument)
  • YamlConverter: Convert to/from YAML formats (YamlStream)

Framework Support

  • .NET STANDARD 2.0
  • .NET 6.0
  • .NET 7.0
  • .NET 8.0
  • .NET 9.0

License

This project is licensed under the terms specified in the LICENSE.txt file.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  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 is compatible.  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 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 is compatible.  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 was computed.  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. 
.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 (1)

Showing the top 1 NuGet packages that depend on MultiFormatDataConverter:

Package Downloads
AbsolutePathHelpers

AbsolutePath helpers for file and folder pathing.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.4 23 7/14/2025
0.2.3 26 7/10/2025
0.2.2 30 7/9/2025
0.2.1 757 6/23/2025
0.2.0 28 6/23/2025
0.1.2 71 6/17/2025
0.1.1 29 6/11/2025
0.1.0 31 6/11/2025