A simplified YAML profile for fast and strict data serialization in C#.
Project details
NanoYaml offers a lightweight and strict YAML-like format for easy data serialization in C#. It prides itself on being round-trip safe, human-readable, and fully compatible with YAML 1.1 and 1.2.2, providing a clean approach to data storage and configuration that remains fast and efficient.
NanoYaml is a specialized configuration format inspired by YAML 1.2.2, designed to provide a strict and simplified experience for data serialization and deserialization in C#. This project stands out by offering a lightweight, round-trip safe format that efficiently handles configurations and data storage for both human-readable local files and automated remote processes.
NanoYaml.cs) facilitates easy integration into .NET 8+ projects, requiring minimal setup and configuration.Serialization and deserialization can be performed with records, classes, and structs. The following is an example demonstrating how to use NanoYaml to serialize and deserialize data:
using System.Collections.Generic;
using Vaxquis.NanoYaml;
// Serializing and Deserializing data
string yaml;
var connectionRaw = new Dictionary<string, object> { ["Host"] = "localhost", ["Port"] = 8080 };
// Serialize
yaml = NanoYaml.Serialize(connectionRaw);
// Deserialize
var unyamlDict = NanoYaml.Deserialize<Dictionary<string, object>>(yaml);
The serialized output maintains a clear and conventional format:
%TAG ! nanoyaml:0.1.0:
---
Host: localhost
Port: 8080
NanoYaml is developed keeping in mind the limitations often encountered in traditional YAML formats. It is inspired by other projects such as StrictYAML and YamlRecords, yet aims to deliver a cleaner and more efficient experience. For a comprehensive feature comparison with YamlDotNet and StrictYAML, refer to the compatibility documentation available in the repository.
This project serves developers looking for a reliable YAML-like solution that addresses common criticisms of YAML while maintaining compliance with its fundamental principles.
Comments
0Start the conversation
Share the first comment.