Tomlyn 0.4.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Tomlyn --version 0.4.1                
NuGet\Install-Package Tomlyn -Version 0.4.1                
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="Tomlyn" Version="0.4.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Tomlyn --version 0.4.1                
#r "nuget: Tomlyn, 0.4.1"                
#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.
// Install Tomlyn as a Cake Addin
#addin nuget:?package=Tomlyn&version=0.4.1

// Install Tomlyn as a Cake Tool
#tool nuget:?package=Tomlyn&version=0.4.1                

Tomlyn Build Status NuGet

<img align="right" width="160px" height="160px" src="img/logo.png">

Tomlyn is a TOML parser, validator and authoring library for .NET Framework and .NET Core

Features

  • Very fast parser, GC friendly.
  • Compatible with the latest TOML 1.0.0 specs.
  • Support perfect load/save roundtrip while preserving all spaces, new line, comments.
  • Provides a validator with the Toml.Validate method.
  • Provides accurate parsing and validation error messages with precise source location.
  • Allow to work on the syntax tree directly (preserving styles) through the Toml.Parse.
  • Allow to work with a runtime representation Toml.ToModel and Toml.ToModel<T> (but cannot be saved back to TOML).
  • Supports for .NET Standard 2.0+.

Usage

var input = @"[mytable]
key = 15
val = true
";

// Gets a syntax tree of the TOML text
var doc = Toml.Parse(input); // returns a DocumentSyntax
// Check for parsing errors with doc.HasErrors and doc.Diagnostics
// doc.HasErrors => throws an exception

// Prints the exact representation of the input
var docStr = doc.ToString();
Console.WriteLine(docStr);

// Gets a runtime representation of the syntax tree
var table = doc.ToModel();
var key = (long) ((TomlTable) table["mytable"])["key"];
var value = (bool) ((TomlTable) table["mytable"])["val"];
Console.WriteLine($"key = {key}, val = {value}");

Creates a TOML document programmatically:

var doc = new DocumentSyntax()
{
    Tables =
    {
        new TableSyntax("test")
        {
            Items =
            {
                {"a", 1},
                {"b", true },
                {"c", "Check"},
                {"d", "ToEscape\nWithAnotherChar\t" },
                {"e", 12.5 },
                {"f", new int[] {1,2,3,4} },
                {"g", new string[] {"0", "1", "2"} },
                {"key with space", 2}
            }
        }
    }
};
Console.WriteLine(doc);
// Prints:
// [test]
// a = 1
// b = true
// c = "Check"
// d = "ToEscape\nWithAnotherChar\t"
// e = 12.5
// f = [1, 2, 3, 4]
// g = ["0", "1", "2"]
// "key with space" = 2

License

This software is released under the BSD-Clause 2 license.

Credits

Modified version of the logo Thor by Mike Rowe from the Noun Project (Creative Commons)

Author

Alexandre Mutel aka xoofx.

Product 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 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.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages (22)

Showing the top 5 NuGet packages that depend on Tomlyn:

Package Downloads
ROFSDB

Package Description

DafnyCore

Package Description

Deislabs.Bindle

Provides a client for Bindle.WARNING: Bindle is experimental. It is not considered production-grade by its developers, neither is it "supported" software.

StateSmith

StateSmith is a cross platform, free/open source tool for generating state machines in multiple languages. The generated code is human readable, has zero dependencies and is suitable for use with tiny bare metal microcontrollers, kernels, computers... It avoids dynamic memory allocations for the safety or performance inclined.

Tomlyn.Extensions.Configuration

TomlConfigurationProvider using Tomlyn

GitHub repositories (17)

Showing the top 5 popular GitHub repositories that depend on Tomlyn:

Repository Stars
dafny-lang/dafny
Dafny is a verification-aware programming language
microsoft/Oryx
Build your repo automatically.
xoofx/dotnet-releaser
Easily build, run tests and coverage, cross-compile, package and publish your .NET library or application to NuGet and GitHub.
StateSmith/StateSmith
A state machine code generation tool suitable for bare metal, embedded and more.
rwmt/Multiplayer
Zetrith's Multiplayer mod for RimWorld
Version Downloads Last updated
0.17.0 353,599 11/23/2023
0.16.2 552,585 12/22/2022
0.16.1 36,909 10/27/2022
0.16.0 23,688 10/20/2022
0.15.1 40,983 10/13/2022
0.15.0 235,661 7/1/2022
0.14.4 2,840 6/21/2022
0.14.3 556,927 5/9/2022
0.14.2 40,950 4/21/2022
0.14.1 1,240 4/3/2022
0.14.0 5,091 3/10/2022
0.13.1 1,079 3/6/2022
0.13.0 1,025 3/5/2022
0.12.1 1,009 3/5/2022
0.12.0 1,587 2/27/2022
0.11.0 1,914 2/14/2022
0.10.2 2,516 2/1/2022
0.10.1 1,188 1/31/2022
0.10.0 1,594 1/27/2022
0.9.1 1,257 1/25/2022
0.9.0 1,392 1/25/2022
0.4.1 1,190 1/23/2022
0.4.0 1,188 1/23/2022
0.3.1 1,355 1/14/2022
0.3.0 1,229 1/14/2022
0.1.2 1,203,062 3/8/2020
0.1.1 10,313 2/13/2019
0.1.0 3,018 2/12/2019