High-performance TOML 1.1 for .NET: lexer/parser, roundtrippable syntax tree, and a System.Text.Json-style object serializer.
System.Text.Json: TomlSerializer, TomlSerializerOptions,
source-generated contexts, and a converter pipeline.
TomlSerializerContext and TomlTypeInfo<T>.
System.Text.Json.Serialization attributes work out of the box
(for example [JsonPropertyName], [JsonIgnore], [JsonConstructor]).
using System.Text.Json;
using Tomlyn;
public sealed record Person(string Name, int Age);
var options = new TomlSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase };
var toml = TomlSerializer.Serialize(new Person("Ada", 37), options);
// name = "Ada"
// age = 37
var person = TomlSerializer.Deserialize<Person>(toml, options);
Next: read the Getting started guide.