tomlyn

Serialize and deserialize TOML files in .NET applications.

13|1|Updated Jun 12, 2026
One-click install
npx skills add https://github.com/meow-sci/gatOS --skill tomlyn
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tomlyn
Source: https://github.com/meow-sci/gatOS/tree/main/.claude/skills/tomlyn
Command: npx skills add https://github.com/meow-sci/gatOS --skill tomlyn

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires System.Text.Json, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill streamlines the serialization and deserialization of TOML files in C#, offering a fast and efficient way to convert between TOML and .NET data structures.

Core Features & Use Cases

  • Object Serialization: Converts TOML documents to .NET objects and vice versa.
  • Low-level Parsing: Provides access to the syntax tree and token stream for advanced use cases.
  • Use Case: Suppose you have a configuration file in TOML format and you want to load it into a .NET application. This Skill can quickly parse the file and populate the necessary data structures.

Quick Start

To serialize an object, use the Tomlyn library as follows:

var serializer = new TomlSerializer();
var config = new ServerConfig { Host = "localhost", Port = 8080 };
var toml = serializer.Serialize(config);

Frequently Asked Questions about tomlyn

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I parse a TOML configuration file into .NET objects?

You can parse TOML configuration files into .NET objects by using a TOML serialization library that maps TOML syntax directly to C# data structures via reflection or source generation. This enables fast loading of application settings.

Can I access the TOML syntax tree for low-level parsing in C#?

Yes, low-level parsing is supported. You can access the TOML syntax tree and token stream directly to perform advanced data processing or build custom tooling, rather than relying solely on automatic object mapping.

Does TOML serialization work with NativeAOT and trimming in .NET?

TOML serialization is fully compatible with NativeAOT and trimming configurations. It supports source generation for object mapping, ensuring safe ahead-of-time compilation without requiring runtime reflection.

What is the best way to serialize .NET objects to TOML format?

The best way to serialize .NET objects to TOML is using a dedicated high-performance serializer. You instantiate a serializer and pass your object to generate valid TOML text, suitable for configuration management and tooling.

Why use TOML for configuration management instead of System.Text.Json?

TOML provides a human-readable, standard syntax for configuration management, whereas System.Text.Json handles JSON. This library integrates TOML parsing into your .NET stack while leveraging System.Text.Json as its underlying dependency.