Skip to content
Basic C# parser for @mojombo's TOML language
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
toml-net.tests Add escaped unicode support Sep 18, 2013
toml-net Add escaped unicode support Sep 18, 2013
.gitattributes Initial Check In - Successfully parsed sample config Feb 24, 2013
.gitignore Clean up for release to May 7, 2013
LICENSE Update LICENSE Mar 1, 2013
toml-net.sln.DotSettings New Parser finished. Passing tests and successfully parsing hard exam… Mar 1, 2013


This is a sample parser in C# for Tom Preson-Werner's (@mojombo) TOML markup language, using C#'s dynamic support.

The code's not the prettiest, but it successfully parses the sample file.

This sample is based off of commit #8a7c1bf27f of Tom's TOML spec.


This library exposes two methods: the static Toml.Parse(string) and extension method str.ParseAsToml().

Both return a dynamic (really an ExpandoObject underneath), that is the hash produced by parsing the string.

See the TOML spec for clarification on this language.


With the following in config.toml:

server = ""
ports = [ 8001, 8001, 8002 ]
connection_max = 5000
enabled = true

You can access this config like so:

var config = File.ReadAllText("config.toml");
string dbServer = config.database.server;
object[] ports = config.database.ports;
int maxConn = config.database.connection_max;

###Note: Arrays have to be implemented as arrays of objects, because per the spec they can contain not only single elements like an int or DateTime, they can also hold other arrays of different types.


  • Fix up parser to support streaming
You can’t perform that action at this time.