CINXE.COM

TOML: English v0.4.0

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta http-equiv="X-UA-Compatible" content="ie=edge" /> <title>TOML: English v0.4.0</title> <link rel="icon" type="image/png" href="/favicon.png" /> <link rel="stylesheet" href="/stylesheets/application.css" /> <script type="text/javascript" src="/javascripts/application.js"></script> </head> <body class="bg-white text-gray-900 font-sans antialiased" data-controller="application"> <header class="items-center bg-white shadow fixed left-0 right-0 z-30 border-t-4 border-orange-800"> <div class="flex flex-1 items-center p-3"> <a class="flex items-center font-mono tracking-tighter" href="index"> <svg class="w-10 mr-2" viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg"> <g> <polygon class="fill-current text-orange-800" points="99.2359551 -7.08546829e-15 99.2359551 14.3820225 112.179775 14.3820225 112.179775 113.617978 99.2359551 113.617978 99.2359551 128 128 128 128 0" ></polygon> <polygon class="fill-current text-black" points="32.3595506 41.7078652 32.3595506 25.8876404 95.6404494 25.8876404 95.6404494 41.7078652 71.9101124 41.7078652 71.9101124 110.741573 56.0898876 110.741573 56.0898876 41.7078652" ></polygon> <polygon class="fill-current text-orange-800" points="28.7640449 0 28.7640449 14.3820225 15.8202247 14.3820225 15.8202247 113.617978 28.7640449 113.617978 28.7640449 128 0 128 0 0" ></polygon> </g> </svg> <pre class="font-mono font-bold text-sm">v1.0.0</pre> </a> </div> <nav class="absolute top-0 right-0 mt-3 w-full md:w-auto py-1 px-2"> <ul class="flex justify-end items-start text-orange-900 text-sm text-center"> <li class="md:w-1/2 md:w-auto mx-2 px-2 bg-white border border-orange-300 rounded"> <div class="w-24"> <a href="#" class="block py-1 px-1" data-action="click->application#showVersions" data-target="application.versionsLink" >Full spec</a > <ul class="hidden block my-2 px-1 text-sm leading-loose" data-target="application.versions"> <li data-target="application.version" data-version="v1.0.0"><a href='/en/v1.0.0'>v1.0.0</a></li> <li data-target="application.version" data-version="v1.0.0-rc.3"><a href='/en/v1.0.0-rc.3'>v1.0.0-rc.3</a></li> <li data-target="application.version" data-version="v1.0.0-rc.2"><a href='/en/v1.0.0-rc.2'>v1.0.0-rc.2</a></li> <li data-target="application.version" data-version="v1.0.0-rc.1"><a href='/en/v1.0.0-rc.1'>v1.0.0-rc.1</a></li> <li data-target="application.version" data-version="v0.5.0"><a href='/en/v0.5.0'>v0.5.0</a></li> <li data-target="application.version" data-version="v0.4.0"><a href='/en/v0.4.0'>v0.4.0</a></li> <li data-target="application.version" data-version="v0.3.1"><a href='/en/v0.3.1'>v0.3.1</a></li> <li data-target="application.version" data-version="v0.3.0"><a href='/en/v0.3.0'>v0.3.0</a></li> <li data-target="application.version" data-version="v0.2.0"><a href='/en/v0.2.0'>v0.2.0</a></li> <li data-target="application.version" data-version="v0.1.0"><a href='/en/v0.1.0'>v0.1.0</a></li> </ul> </div> </li> <li class="md:w-1/2 md:w-auto mx-2 px-2 bg-white border border-orange-300 rounded"> <div class="w-16 md:w-24"> <a href="#" class="block py-1 px-1" data-action="click->application#showLanguages" data-target="application.languagesLink" >Language</a > <ul class="hidden my-2 text-sm leading-loose text-center" data-target="application.languages" > <li data-target="application.language" data-language="cn"><a href='/cn/v1.0.0'>简体中文</a></li> <li data-target="application.language" data-language="en"><a href='/en/v1.0.0'>English</a></li> <li data-target="application.language" data-language="fr"><a href='/fr/v1.0.0'>Français</a></li> <li data-target="application.language" data-language="ja"><a href='/ja/v1.0.0'>日本語</a></li> <li data-target="application.language" data-language="ko"><a href='/ko/v1.0.0'>한국어</a></li> <li data-target="application.language" data-language="pl"><a href='/pl/v1.0.0'>Polski</a></li> <li data-target="application.language" data-language="pt"><a href='/pt/v1.0.0'>Português</a></li> </ul> </div> </li> <li class="hidden sm:block mt-1 mx-2"> <a class="block w-6" href="https://github.com/toml-lang/toml" title="Go to TOML's GitHub repo"> <svg viewBox="0 0 32 32" class="transition duration-200 fill-current text-orange-400 hover:text-orange-700" xmlns="http://www.w3.org/2000/svg"> <path d="M15.9995 -8.73473e-07C12.198 -0.00275596 8.5196 1.34817 5.62346 3.81077C2.72731 6.27336 0.802616 9.6867 0.194194 13.4393C-0.414229 17.1919 0.333374 21.0385 2.30307 24.29C4.27276 27.5415 7.33584 29.9855 10.9435 31.184C11.7435 31.344 12.0315 30.832 12.0315 30.416L12.0155 27.696C7.56755 28.656 6.62355 25.552 6.62355 25.552C5.88755 23.696 4.84755 23.2 4.84755 23.2C3.40755 22.208 4.95955 22.24 4.95955 22.24C6.55955 22.352 7.40755 23.888 7.40755 23.888C8.84755 26.32 11.1515 25.616 12.0635 25.216C12.2235 24.176 12.6235 23.472 13.0715 23.072C9.51955 22.672 5.79155 21.296 5.79155 15.168C5.79155 13.408 6.41555 11.984 7.43955 10.864C6.95565 9.4866 7.01283 7.97684 7.59955 6.64C7.59955 6.64 8.94355 6.208 11.9995 8.272C14.6192 7.56384 17.3799 7.56384 19.9995 8.272C23.0555 6.192 24.3995 6.64 24.3995 6.64C25.2795 8.832 24.7195 10.48 24.5595 10.864C25.5835 11.984 26.2075 13.424 26.2075 15.168C26.2075 21.312 22.4635 22.656 18.8955 23.056C19.4715 23.552 19.9835 24.528 19.9835 26.016L19.9675 30.416C19.9675 30.832 20.2555 31.344 21.0715 31.184C24.6806 29.985 27.7445 27.5398 29.7141 24.2866C31.6837 21.0334 32.4302 17.185 31.8197 13.4314C31.2092 9.67772 29.2816 6.26427 26.3825 3.80296C23.4835 1.34165 19.8025 -0.00657403 15.9995 -8.73473e-07Z" /> </svg> </a> </li> </ul> </nav> </header> <div class="spec" data-controller="nav" data-action="scroll@window->nav#scroll"> <div class="lg:flex pt-14"> <aside class="w-full bg-white lg:w-64 lg:pr-64 lg:block"> <div class="fixed bg-white z-20 left-0 right-0 mt-3 pl-4 py-4 border-b lg:hidden" data-target="nav.menuLink"> <div class="relative"> <a href="#" class="block font-semibold lg:hidden text-orange-800" data-action="click->nav#onMenuClick">Menu</a> <div class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-700"> <svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"></path></svg> </div> </div> </div> <nav class="hidden fixed w-full overflow-y-scroll top-0 bottom-0 bg-white z-10 py-32 pb-8 px-4 leading-snug lg:w-68 lg:block lg:pl-8 lg:py-24" data-target="nav.menu"> <ul> <li><a href="#objectives" data-target="nav.link" data-action="click->nav#click" data-id="objectives">Objectives</a></li> <li><a href="#spec" data-target="nav.link" data-action="click->nav#click" data-id="spec">Spec</a></li> <li><a href="#comment" data-target="nav.link" data-action="click->nav#click" data-id="comment">Comment</a></li> <li><a href="#string" data-target="nav.link" data-action="click->nav#click" data-id="string">String</a></li> <li><a href="#integer" data-target="nav.link" data-action="click->nav#click" data-id="integer">Integer</a></li> <li><a href="#float" data-target="nav.link" data-action="click->nav#click" data-id="float">Float</a></li> <li><a href="#boolean" data-target="nav.link" data-action="click->nav#click" data-id="boolean">Boolean</a></li> <li><a href="#datetime" data-target="nav.link" data-action="click->nav#click" data-id="datetime">Datetime</a></li> <li><a href="#array" data-target="nav.link" data-action="click->nav#click" data-id="array">Array</a></li> <li><a href="#table" data-target="nav.link" data-action="click->nav#click" data-id="table">Table</a></li> <li><a href="#inline-table" data-target="nav.link" data-action="click->nav#click" data-id="inline-table">Inline Table</a></li> <li><a href="#array-of-tables" data-target="nav.link" data-action="click->nav#click" data-id="array-of-tables">Array of Tables</a></li> <li><a href="#seriously" data-target="nav.link" data-action="click->nav#click" data-id="seriously">Seriously?</a></li> <li><a href="#but-why" data-target="nav.link" data-action="click->nav#click" data-id="but-why">But why?</a></li> <li><a href="#oh-god-youre-right" data-target="nav.link" data-action="click->nav#click" data-id="oh-god-youre-right">Oh god, you're right</a></li> <li><a href="#projects-using-toml" data-target="nav.link" data-action="click->nav#click" data-id="projects-using-toml">Projects using TOML</a></li> <li><a href="#implementations" data-target="nav.link" data-action="click->nav#click" data-id="implementations">Implementations</a></li> <li><a href="#validators" data-target="nav.link" data-action="click->nav#click" data-id="validators">Validators</a></li> <li><a href="#language-agnostic-test-suite-for-toml-decoders-and-encoders" data-target="nav.link" data-action="click->nav#click" data-id="language-agnostic-test-suite-for-toml-decoders-and-encoders">Language agnostic test suite for TOML decoders and encoders</a></li> <li><a href="#editor-support" data-target="nav.link" data-action="click->nav#click" data-id="editor-support">Editor support</a></li> <li><a href="#encoder" data-target="nav.link" data-action="click->nav#click" data-id="encoder">Encoder</a></li> <li><a href="#converters" data-target="nav.link" data-action="click->nav#click" data-id="converters">Converters</a></li></ul> </nav> </aside> <main class="overflow-auto"> <div class="w-full lg:max-w-4xl mx-auto bg-white p-8 spec"> <span class="block text-left md:text-right mt-16 md:mt-0"> Published on 2/12/2015 – <a href="https://raw.githubusercontent.com/toml-lang/toml.io/main/specs/en/v0.4.0.md">Text version</a> </span> <h1 id="toml-v040">TOML v0.4.0</h1> <p>Tom&#39;s Obvious, Minimal Language.</p> <p>By Tom Preston-Werner.</p> <p>Be warned, this spec is still changing a lot. Until it&#39;s marked as 1.0, you should assume that it is unstable and act accordingly.</p> <h2 id="objectives" data-target="nav.header"> <a href="#objectives">Objectives</a> </h2> <p>TOML aims to be a minimal configuration file format that&#39;s easy to read due to obvious semantics. TOML is designed to map unambiguously to a hash table. TOML should be easy to parse into data structures in a wide variety of languages.</p> <h2 id="spec" data-target="nav.header"> <a href="#spec">Spec</a> </h2> <ul> <li>TOML is case sensitive.</li> <li>A TOML file must contain only UTF-8 encoded Unicode characters.</li> <li>Whitespace means tab (0x09) or space (0x20).</li> <li>Newline means LF (0x0A) or CRLF (0x0D0A).</li> </ul> <h2 id="comment" data-target="nav.header"> <a href="#comment">Comment</a> </h2> <p>Speak your mind with the hash symbol. They go from the symbol to the end of the line.</p> <pre><code data-controller="snippet" class="language-toml"># I am a comment. Hear me roar. Roar. key = &quot;value&quot; # Yeah, you can do this.</code></pre> <h2 id="string" data-target="nav.header"> <a href="#string">String</a> </h2> <p>There are four ways to express strings: basic, multi-line basic, literal, and multi-line literal. All strings must contain only valid UTF-8 characters.</p> <p><strong>Basic strings</strong> are surrounded by quotation marks. Any Unicode character may be used except those that must be escaped: quotation mark, backslash, and the control characters (U+0000 to U+001F).</p> <pre><code data-controller="snippet" class="language-toml">&quot;I&#39;m a string. \&quot;You can quote me\&quot;. Name\tJos\u00E9\nLocation\tSF.&quot;</code></pre> <p>For convenience, some popular characters have a compact escape sequence.</p> <pre><code data-controller="snippet" class="language-toml">\b - backspace (U+0008) \t - tab (U+0009) \n - linefeed (U+000A) \f - form feed (U+000C) \r - carriage return (U+000D) \&quot; - quote (U+0022) \\ - backslash (U+005C) \uXXXX - unicode (U+XXXX) \UXXXXXXXX - unicode (U+XXXXXXXX)</code></pre> <p>Any Unicode character may be escaped with the <code>\uXXXX</code> or <code>\UXXXXXXXX</code> forms. The escape codes must be valid Unicode <a href="http://unicode.org/glossary/#unicode_scalar_value">scalar values</a>.</p> <p>All other escape sequences not listed above are reserved and, if used, TOML should produce an error.</p> <p>Sometimes you need to express passages of text (e.g. translation files) or would like to break up a very long string into multiple lines. TOML makes this easy. <strong>Multi-line basic strings</strong> are surrounded by three quotation marks on each side and allow newlines. A newline immediately following the opening delimiter will be trimmed. All other whitespace and newline characters remain intact.</p> <pre><code data-controller="snippet" class="language-toml">key1 = &quot;&quot;&quot; Roses are red Violets are blue&quot;&quot;&quot;</code></pre> <p>TOML parsers should feel free to normalize newline to whatever makes sense for their platform.</p> <pre><code data-controller="snippet" class="language-toml"># On a Unix system, the above multi-line string will most likely be the same as: key2 = &quot;Roses are red\nViolets are blue&quot; # On a Windows system, it will most likely be equivalent to: key3 = &quot;Roses are red\r\nViolets are blue&quot;</code></pre> <p>For writing long strings without introducing extraneous whitespace, end a line with a <code>\</code>. The <code>\</code> will be trimmed along with all whitespace (including newlines) up to the next non-whitespace character or closing delimiter. If the first characters after the opening delimiter are a backslash and a newline, then they will both be trimmed along with all whitespace and newlines up to the next non-whitespace character or closing delimiter. All of the escape sequences that are valid for basic strings are also valid for multi-line basic strings.</p> <pre><code data-controller="snippet" class="language-toml"># The following strings are byte-for-byte equivalent: key1 = &quot;The quick brown fox jumps over the lazy dog.&quot; key2 = &quot;&quot;&quot; The quick brown \ fox jumps over \ the lazy dog.&quot;&quot;&quot; key3 = &quot;&quot;&quot;\ The quick brown \ fox jumps over \ the lazy dog.\ &quot;&quot;&quot;</code></pre> <p>Any Unicode character may be used except those that must be escaped: backslash and the control characters (U+0000 to U+001F). Quotation marks need not be escaped unless their presence would create a premature closing delimiter.</p> <p>If you&#39;re a frequent specifier of Windows paths or regular expressions, then having to escape backslashes quickly becomes tedious and error prone. To help, TOML supports literal strings where there is no escaping allowed at all. <strong>Literal strings</strong> are surrounded by single quotes. Like basic strings, they must appear on a single line:</p> <pre><code data-controller="snippet" class="language-toml"># What you see is what you get. winpath = &#39;C:\Users\nodejs\templates&#39; winpath2 = &#39;\\ServerX\admin$\system32\&#39; quoted = &#39;Tom &quot;Dubs&quot; Preston-Werner&#39; regex = &#39;&lt;\i\c*\s*&gt;&#39;</code></pre> <p>Since there is no escaping, there is no way to write a single quote inside a literal string enclosed by single quotes. Luckily, TOML supports a multi-line version of literal strings that solves this problem. <strong>Multi-line literal strings</strong> are surrounded by three single quotes on each side and allow newlines. Like literal strings, there is no escaping whatsoever. A newline immediately following the opening delimiter will be trimmed. All other content between the delimiters is interpreted as-is without modification.</p> <pre><code data-controller="snippet" class="language-toml">regex2 = &#39;&#39;&#39;I [dw]on&#39;t need \d{2} apples&#39;&#39;&#39; lines = &#39;&#39;&#39; The first newline is trimmed in raw strings. All other whitespace is preserved. &#39;&#39;&#39;</code></pre> <p>For binary data it is recommended that you use Base64 or another suitable ASCII or UTF-8 encoding. The handling of that encoding will be application specific.</p> <h2 id="integer" data-target="nav.header"> <a href="#integer">Integer</a> </h2> <p>Integers are whole numbers. Positive numbers may be prefixed with a plus sign. Negative numbers are prefixed with a minus sign.</p> <pre><code data-controller="snippet" class="language-toml">+99 42 0 -17</code></pre> <p>For large numbers, you may use underscores to enhance readability. Each underscore must be surrounded by at least one digit.</p> <pre><code data-controller="snippet" class="language-toml">1_000 5_349_221 1_2_3_4_5 # valid but inadvisable</code></pre> <p>Leading zeros are not allowed. Hex, octal, and binary forms are not allowed. Values such as &quot;infinity&quot; and &quot;not a number&quot; that cannot be expressed as a series of digits are not allowed.</p> <p>64 bit (signed long) range expected (−9,223,372,036,854,775,808 to 9,223,372,036,854,775,807).</p> <h2 id="float" data-target="nav.header"> <a href="#float">Float</a> </h2> <p>A float consists of an integer part (which may be prefixed with a plus or minus sign) followed by a fractional part and/or an exponent part. If both a fractional part and exponent part are present, the fractional part must precede the exponent part.</p> <pre><code data-controller="snippet" class="language-toml"># fractional +1.0 3.1415 -0.01 # exponent 5e+22 1e6 -2E-2 # both 6.626e-34</code></pre> <p>A fractional part is a decimal point followed by one or more digits.</p> <p>An exponent part is an E (upper or lower case) followed by an integer part (which may be prefixed with a plus or minus sign).</p> <p>Similar to integers, you may use underscores to enhance readability. Each underscore must be surrounded by at least one digit.</p> <pre><code data-controller="snippet" class="language-toml">9_224_617.445_991_228_313 1e1_000</code></pre> <p>64-bit (double) precision expected.</p> <h2 id="boolean" data-target="nav.header"> <a href="#boolean">Boolean</a> </h2> <p>Booleans are just the tokens you&#39;re used to. Always lowercase.</p> <pre><code data-controller="snippet" class="language-toml">true false</code></pre> <h2 id="datetime" data-target="nav.header"> <a href="#datetime">Datetime</a> </h2> <p>Datetimes are <a href="http://tools.ietf.org/html/rfc3339">RFC 3339</a> dates.</p> <pre><code data-controller="snippet" class="language-toml">1979-05-27T07:32:00Z 1979-05-27T00:32:00-07:00 1979-05-27T00:32:00.999999-07:00</code></pre> <h2 id="array" data-target="nav.header"> <a href="#array">Array</a> </h2> <p>Arrays are square brackets with other primitives inside. Whitespace is ignored. Elements are separated by commas. Data types may not be mixed (though all string types should be considered the same type).</p> <pre><code data-controller="snippet" class="language-toml">[ 1, 2, 3 ] [ &quot;red&quot;, &quot;yellow&quot;, &quot;green&quot; ] [ [ 1, 2 ], [3, 4, 5] ] [ &quot;all&quot;, &#39;strings&#39;, &quot;&quot;&quot;are the same&quot;&quot;&quot;, &#39;&#39;&#39;type&#39;&#39;&#39;] # this is ok [ [ 1, 2 ], [&quot;a&quot;, &quot;b&quot;, &quot;c&quot;] ] # this is ok [ 1, 2.0 ] # note: this is NOT ok</code></pre> <p>Arrays can also be multiline. So in addition to ignoring whitespace, arrays also ignore newlines between the brackets. Terminating commas are ok before the closing bracket.</p> <pre><code data-controller="snippet" class="language-toml">key = [ 1, 2, 3 ] key = [ 1, 2, # this is ok ]</code></pre> <h2 id="table" data-target="nav.header"> <a href="#table">Table</a> </h2> <p>Tables (also known as hash tables or dictionaries) are collections of key/value pairs. They appear in square brackets on a line by themselves. You can tell them apart from arrays because arrays are only ever values.</p> <pre><code data-controller="snippet" class="language-toml">[table]</code></pre> <p>Under that, and until the next table or EOF are the key/values of that table. Keys are on the left of the equals sign and values are on the right. Whitespace is ignored around key names and values. The key, equals sign, and value must be on the same line (though some values can be broken over multiple lines).</p> <p>Keys may be either bare or quoted. <strong>Bare keys</strong> may only contain letters, numbers, underscores, and dashes (<code>A-Za-z0-9_-</code>). <strong>Quoted keys</strong> follow the exact same rules as basic strings and allow you to use a much broader set of key names. Best practice is to use bare keys except when absolutely necessary.</p> <p>Key/value pairs within tables are not guaranteed to be in any specific order.</p> <pre><code data-controller="snippet" class="language-toml">[table] key = &quot;value&quot; bare_key = &quot;value&quot; bare-key = &quot;value&quot; &quot;127.0.0.1&quot; = &quot;value&quot; &quot;character encoding&quot; = &quot;value&quot; &quot;ʎǝʞ&quot; = &quot;value&quot;</code></pre> <p>Dots are prohibited in bare keys because dots are used to signify nested tables! Naming rules for each dot separated part are the same as for keys (see above).</p> <pre><code data-controller="snippet" class="language-toml">[dog.&quot;tater.man&quot;] type = &quot;pug&quot;</code></pre> <p>In JSON land, that would give you the following structure:</p> <pre><code data-controller="snippet" class="language-json">{ &quot;dog&quot;: { &quot;tater.man&quot;: { &quot;type&quot;: &quot;pug&quot; } } }</code></pre> <p>Whitespace around dot-separated parts is ignored, however, best practice is to not use any extraneous whitespace.</p> <pre><code data-controller="snippet" class="language-toml">[a.b.c] # this is best practice [ d.e.f ] # same as [d.e.f] [ g . h . i ] # same as [g.h.i] [ j . &quot;ʞ&quot; . l ] # same as [j.&quot;ʞ&quot;.l]</code></pre> <p>You don&#39;t need to specify all the super-tables if you don&#39;t want to. TOML knows how to do it for you.</p> <pre><code data-controller="snippet" class="language-toml"># [x] you # [x.y] don&#39;t # [x.y.z] need these [x.y.z.w] # for this to work</code></pre> <p>Empty tables are allowed and simply have no key/value pairs within them.</p> <p>As long as a super-table hasn&#39;t been directly defined and hasn&#39;t defined a specific key, you may still write to it.</p> <pre><code data-controller="snippet" class="language-toml">[a.b] c = 1 [a] d = 2</code></pre> <p>You cannot define any key or table more than once. Doing so is invalid.</p> <pre><code data-controller="snippet" class="language-toml"># DO NOT DO THIS [a] b = 1 [a] c = 2</code></pre> <pre><code data-controller="snippet" class="language-toml"># DO NOT DO THIS EITHER [a] b = 1 [a.b] c = 2</code></pre> <p>All table names and keys must be non-empty.</p> <pre><code data-controller="snippet" class="language-toml"># NOT VALID TOML [] [a.] [a..b] [.b] [.] = &quot;no key name&quot; # not allowed</code></pre> <h2 id="inline-table" data-target="nav.header"> <a href="#inline-table">Inline Table</a> </h2> <p>Inline tables provide a more compact syntax for expressing tables. They are especially useful for grouped data that can otherwise quickly become verbose. Inline tables are enclosed in curly braces <code>{</code> and <code>}</code>. Within the braces, zero or more comma separated key/value pairs may appear. Key/value pairs take the same form as key/value pairs in standard tables. All value types are allowed, including inline tables.</p> <p>Inline tables are intended to appear on a single line. No newlines are allowed between the curly braces unless they are valid within a value. Even so, it is strongly discouraged to break an inline table onto multiples lines. If you find yourself gripped with this desire, it means you should be using standard tables.</p> <pre><code data-controller="snippet" class="language-toml">name = { first = &quot;Tom&quot;, last = &quot;Preston-Werner&quot; } point = { x = 1, y = 2 }</code></pre> <p>The inline tables above are identical to the following standard table definitions:</p> <pre><code data-controller="snippet" class="language-toml">[name] first = &quot;Tom&quot; last = &quot;Preston-Werner&quot; [point] x = 1 y = 2</code></pre> <h2 id="array-of-tables" data-target="nav.header"> <a href="#array-of-tables">Array of Tables</a> </h2> <p>The last type that has not yet been expressed is an array of tables. These can be expressed by using a table name in double brackets. Each table with the same double bracketed name will be an element in the array. The tables are inserted in the order encountered. A double bracketed table without any key/value pairs will be considered an empty table.</p> <pre><code data-controller="snippet" class="language-toml">[[products]] name = &quot;Hammer&quot; sku = 738594937 [[products]] [[products]] name = &quot;Nail&quot; sku = 284758393 color = &quot;gray&quot;</code></pre> <p>In JSON land, that would give you the following structure.</p> <pre><code data-controller="snippet" class="language-json">{ &quot;products&quot;: [ { &quot;name&quot;: &quot;Hammer&quot;, &quot;sku&quot;: 738594937 }, { }, { &quot;name&quot;: &quot;Nail&quot;, &quot;sku&quot;: 284758393, &quot;color&quot;: &quot;gray&quot; } ] }</code></pre> <p>You can create nested arrays of tables as well. Just use the same double bracket syntax on sub-tables. Each double-bracketed sub-table will belong to the most recently defined table element above it.</p> <pre><code data-controller="snippet" class="language-toml">[[fruit]] name = &quot;apple&quot; [fruit.physical] color = &quot;red&quot; shape = &quot;round&quot; [[fruit.variety]] name = &quot;red delicious&quot; [[fruit.variety]] name = &quot;granny smith&quot; [[fruit]] name = &quot;banana&quot; [[fruit.variety]] name = &quot;plantain&quot;</code></pre> <p>The above TOML maps to the following JSON.</p> <pre><code data-controller="snippet" class="language-json">{ &quot;fruit&quot;: [ { &quot;name&quot;: &quot;apple&quot;, &quot;physical&quot;: { &quot;color&quot;: &quot;red&quot;, &quot;shape&quot;: &quot;round&quot; }, &quot;variety&quot;: [ { &quot;name&quot;: &quot;red delicious&quot; }, { &quot;name&quot;: &quot;granny smith&quot; } ] }, { &quot;name&quot;: &quot;banana&quot;, &quot;variety&quot;: [ { &quot;name&quot;: &quot;plantain&quot; } ] } ] }</code></pre> <p>Attempting to define a normal table with the same name as an already established array must produce an error at parse time.</p> <pre><code data-controller="snippet" class="language-toml"># INVALID TOML DOC [[fruit]] name = &quot;apple&quot; [[fruit.variety]] name = &quot;red delicious&quot; # This table conflicts with the previous table [fruit.variety] name = &quot;granny smith&quot;</code></pre> <p>You may also use inline tables where appropriate:</p> <pre><code data-controller="snippet" class="language-toml">points = [ { x = 1, y = 2, z = 3 }, { x = 7, y = 8, z = 9 }, { x = 2, y = 4, z = 8 } ]</code></pre> <h2 id="seriously" data-target="nav.header"> <a href="#seriously">Seriously?</a> </h2> <p>Yep.</p> <h2 id="but-why" data-target="nav.header"> <a href="#but-why">But why?</a> </h2> <p>Because we need a decent human-readable format that unambiguously maps to a hash table and the YAML spec is like 80 pages long and gives me rage. No, JSON doesn&#39;t count. You know why.</p> <h2 id="oh-god-youre-right" data-target="nav.header"> <a href="#oh-god-youre-right">Oh god, you're right</a> </h2> <p>Yuuuup. Wanna help? Send a pull request. Or write a parser. BE BRAVE.</p> <h2 id="projects-using-toml" data-target="nav.header"> <a href="#projects-using-toml">Projects using TOML</a> </h2> <ul> <li><a href="http://doc.crates.io/">Cargo</a> - The Rust language&#39;s package manager.</li> <li><a href="http://influxdb.com/">InfluxDB</a> - Distributed time series database.</li> <li><a href="https://hekad.readthedocs.org">Heka</a> - Stream processing system by Mozilla.</li> <li><a href="http://gohugo.io/">Hugo</a> - Static site generator in Go.</li> </ul> <h2 id="implementations" data-target="nav.header"> <a href="#implementations">Implementations</a> </h2> <p>If you have an implementation, send a pull request adding to this list. Please note the commit SHA1 or version tag that your parser supports in your Readme.</p> <ul> <li>C#/.NET - <a href="https://github.com/LBreedlove/Toml.net">https://github.com/LBreedlove/Toml.net</a></li> <li>C#/.NET - <a href="https://github.com/rossipedia/toml-net">https://github.com/rossipedia/toml-net</a></li> <li>C#/.NET - <a href="https://github.com/RichardVasquez/TomlDotNet">https://github.com/RichardVasquez/TomlDotNet</a></li> <li>C#/.NET - <a href="https://github.com/azyobuzin/HyperTomlProcessor">https://github.com/azyobuzin/HyperTomlProcessor</a></li> <li>C (@ajwans) - <a href="https://github.com/ajwans/libtoml">https://github.com/ajwans/libtoml</a></li> <li>C (@mzgoddard) - <a href="https://github.com/mzgoddard/tomlc">https://github.com/mzgoddard/tomlc</a></li> <li>C++ (@evilncrazy) - <a href="https://github.com/evilncrazy/ctoml">https://github.com/evilncrazy/ctoml</a></li> <li>C++ (@skystrife) - <a href="https://github.com/skystrife/cpptoml">https://github.com/skystrife/cpptoml</a></li> <li>C++ (@mayah) - <a href="https://github.com/mayah/tinytoml">https://github.com/mayah/tinytoml</a></li> <li>Clojure (@lantiga) - <a href="https://github.com/lantiga/clj-toml">https://github.com/lantiga/clj-toml</a></li> <li>Clojure (@manicolosi) - <a href="https://github.com/manicolosi/clojoml">https://github.com/manicolosi/clojoml</a></li> <li>CoffeeScript (@biilmann) - <a href="https://github.com/biilmann/coffee-toml">https://github.com/biilmann/coffee-toml</a></li> <li>Common Lisp (@pnathan) - <a href="https://github.com/pnathan/pp-toml">https://github.com/pnathan/pp-toml</a></li> <li>D - <a href="https://github.com/iccodegr/toml.d">https://github.com/iccodegr/toml.d</a></li> <li>Dart (@just95) - <a href="https://github.com/just95/toml.dart">https://github.com/just95/toml.dart</a></li> <li>Erlang - <a href="https://github.com/kalta/etoml.git">https://github.com/kalta/etoml.git</a></li> <li>Erlang - <a href="https://github.com/kaos/tomle">https://github.com/kaos/tomle</a></li> <li>Emacs Lisp (@gongoZ) - <a href="https://github.com/gongo/emacs-toml">https://github.com/gongo/emacs-toml</a></li> <li>Go (@thompelletier) - <a href="https://github.com/pelletier/go-toml">https://github.com/pelletier/go-toml</a></li> <li>Go (@laurent22) - <a href="https://github.com/laurent22/toml-go">https://github.com/laurent22/toml-go</a></li> <li>Go w/ Reflection (@BurntSushi) - <a href="https://github.com/BurntSushi/toml">https://github.com/BurntSushi/toml</a></li> <li>Go (@achun) - <a href="https://github.com/achun/tom-toml">https://github.com/achun/tom-toml</a></li> <li>Go (@naoina) - <a href="https://github.com/naoina/toml">https://github.com/naoina/toml</a></li> <li>Haskell (@seliopou) - <a href="https://github.com/seliopou/toml">https://github.com/seliopou/toml</a></li> <li>Haxe (@raincole) - <a href="https://github.com/raincole/haxetoml">https://github.com/raincole/haxetoml</a></li> <li>Java (@agrison) - <a href="https://github.com/agrison/jtoml">https://github.com/agrison/jtoml</a></li> <li>Java (@johnlcox) - <a href="https://github.com/johnlcox/toml4j">https://github.com/johnlcox/toml4j</a></li> <li>Java (@mwanji) - <a href="https://github.com/mwanji/toml4j">https://github.com/mwanji/toml4j</a></li> <li>Java - <a href="https://github.com/asafh/jtoml">https://github.com/asafh/jtoml</a></li> <li>Java w/ ANTLR (@MatthiasSchuetz) - <a href="https://github.com/mschuetz/toml">https://github.com/mschuetz/toml</a></li> <li>Julia (@pygy) - <a href="https://github.com/pygy/TOML.jl">https://github.com/pygy/TOML.jl</a></li> <li>Literate CoffeeScript (@JonathanAbrams) - <a href="https://github.com/JonAbrams/tomljs">https://github.com/JonAbrams/tomljs</a></li> <li>Nim (@ziotom78) - <a href="https://github.com/ziotom78/parsetoml">https://github.com/ziotom78/parsetoml</a></li> <li>node.js/browser - <a href="https://github.com/ricardobeat/toml.js">https://github.com/ricardobeat/toml.js</a> (npm install tomljs)</li> <li>node.js - <a href="https://github.com/BinaryMuse/toml-node">https://github.com/BinaryMuse/toml-node</a></li> <li>node.js/browser (@redhotvengeance) - <a href="https://github.com/redhotvengeance/topl">https://github.com/redhotvengeance/topl</a> (topl npm package)</li> <li>node.js/browser (@alexanderbeletsky) - <a href="https://github.com/alexanderbeletsky/toml-js">https://github.com/alexanderbeletsky/toml-js</a> (npm browser amd)</li> <li>Objective C (@mneorr) - <a href="https://github.com/mneorr/toml-objc.git">https://github.com/mneorr/toml-objc.git</a></li> <li>Objective-C (@SteveStreza) - <a href="https://github.com/amazingsyco/TOML">https://github.com/amazingsyco/TOML</a></li> <li>OCaml (@mackwic) <a href="https://github.com/mackwic/to.ml">https://github.com/mackwic/to.ml</a></li> <li>Perl (@alexkalderimis) - <a href="https://github.com/alexkalderimis/config-toml.pl">https://github.com/alexkalderimis/config-toml.pl</a></li> <li>Perl - <a href="https://github.com/dlc/toml">https://github.com/dlc/toml</a></li> <li>PHP (@leonelquinteros) - <a href="https://github.com/leonelquinteros/php-toml.git">https://github.com/leonelquinteros/php-toml.git</a></li> <li>PHP (@jimbomoss) - <a href="https://github.com/jamesmoss/toml">https://github.com/jamesmoss/toml</a></li> <li>PHP (@coop182) - <a href="https://github.com/coop182/toml-php">https://github.com/coop182/toml-php</a></li> <li>PHP (@checkdomain) - <a href="https://github.com/checkdomain/toml">https://github.com/checkdomain/toml</a></li> <li>PHP (@zidizei) - <a href="https://github.com/zidizei/toml-php">https://github.com/zidizei/toml-php</a></li> <li>PHP (@yosymfony) - <a href="https://github.com/yosymfony/toml">https://github.com/yosymfony/toml</a></li> <li>Python (@f03lipe) - <a href="https://github.com/f03lipe/toml-python">https://github.com/f03lipe/toml-python</a></li> <li>Python (@uiri) - <a href="https://github.com/uiri/toml">https://github.com/uiri/toml</a></li> <li>Python - <a href="https://github.com/bryant/pytoml">https://github.com/bryant/pytoml</a></li> <li>Python (@elssar) - <a href="https://github.com/elssar/tomlgun">https://github.com/elssar/tomlgun</a></li> <li>Python (@marksteve) - <a href="https://github.com/marksteve/toml-ply">https://github.com/marksteve/toml-ply</a></li> <li>Python (@hit9) - <a href="https://github.com/hit9/toml.py">https://github.com/hit9/toml.py</a></li> <li>Racket (@greghendershott) - <a href="https://github.com/greghendershott/toml">https://github.com/greghendershott/toml</a></li> <li>Ruby (@jm) - <a href="https://github.com/jm/toml">https://github.com/jm/toml</a> (toml gem)</li> <li>Ruby (@eMancu) - <a href="https://github.com/eMancu/toml-rb">https://github.com/eMancu/toml-rb</a> (toml-rb gem)</li> <li>Ruby (@charliesome) - <a href="https://github.com/charliesome/toml2">https://github.com/charliesome/toml2</a> (toml2 gem)</li> <li>Ruby (@sandeepravi) - <a href="https://github.com/sandeepravi/tomlp">https://github.com/sandeepravi/tomlp</a> (tomlp gem)</li> <li>Rust (@mneumann) - <a href="https://github.com/mneumann/rust-toml">https://github.com/mneumann/rust-toml</a></li> <li>Rust (@alexcrichton) - <a href="https://github.com/alexcrichton/toml-rs">https://github.com/alexcrichton/toml-rs</a></li> <li>Scala - <a href="https://github.com/axelarge/tomelette">https://github.com/axelarge/tomelette</a></li> </ul> <h2 id="validators" data-target="nav.header"> <a href="#validators">Validators</a> </h2> <ul> <li>Go (@BurntSushi) - <a href="https://github.com/BurntSushi/toml/tree/master/cmd/tomlv">https://github.com/BurntSushi/toml/tree/master/cmd/tomlv</a></li> </ul> <h2 id="language-agnostic-test-suite-for-toml-decoders-and-encoders" data-target="nav.header"> <a href="#language-agnostic-test-suite-for-toml-decoders-and-encoders">Language agnostic test suite for TOML decoders and encoders</a> </h2> <ul> <li>toml-test (@BurntSushi) - <a href="https://github.com/BurntSushi/toml-test">https://github.com/BurntSushi/toml-test</a></li> </ul> <h2 id="editor-support" data-target="nav.header"> <a href="#editor-support">Editor support</a> </h2> <ul> <li>Atom - <a href="https://github.com/atom/language-toml">https://github.com/atom/language-toml</a></li> <li>Emacs (@dryman) - <a href="https://github.com/dryman/toml-mode.el">https://github.com/dryman/toml-mode.el</a></li> <li>Notepad++ (@fireforge) - <a href="https://github.com/fireforge/toml-notepadplusplus">https://github.com/fireforge/toml-notepadplusplus</a></li> <li>Sublime Text 2 &amp; 3 (@Gakai) - <a href="https://github.com/Gakai/sublime_toml_highlighting">https://github.com/Gakai/sublime_toml_highlighting</a></li> <li>Synwrite - <a href="http://uvviewsoft.com/synwrite/download.html">http://uvviewsoft.com/synwrite/download.html</a> ; call Options/ Addons manager/ Install</li> <li>TextMate (@infininight) - <a href="https://github.com/textmate/toml.tmbundle">https://github.com/textmate/toml.tmbundle</a></li> <li>Vim (@cespare) - <a href="https://github.com/cespare/vim-toml">https://github.com/cespare/vim-toml</a></li> </ul> <h2 id="encoder" data-target="nav.header"> <a href="#encoder">Encoder</a> </h2> <ul> <li>Dart (@just95) - <a href="https://github.com/just95/toml.dart">https://github.com/just95/toml.dart</a></li> <li>Go w/ Reflection (@BurntSushi) - <a href="https://github.com/BurntSushi/toml">https://github.com/BurntSushi/toml</a></li> <li>PHP (@ayushchd) - <a href="https://github.com/ayushchd/php-toml-encoder">https://github.com/ayushchd/php-toml-encoder</a></li> </ul> <h2 id="converters" data-target="nav.header"> <a href="#converters">Converters</a> </h2> <ul> <li>remarshal (@dbohdan) - <a href="https://github.com/dbohdan/remarshal">https://github.com/dbohdan/remarshal</a></li> <li>yaml2toml (@jtyr) - <a href="https://github.com/jtyr/yaml2toml-converter">https://github.com/jtyr/yaml2toml-converter</a></li> <li>yaml2toml.dart (@just95) - <a href="https://github.com/just95/yaml2toml.dart">https://github.com/just95/yaml2toml.dart</a></li> </ul> </div> </main> </div> </div> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10