TOML → XML Converter
Convert TOML to XML locally. TOML datetimes become ISO-8601 strings; arrays become repeated elements.
Conversion pipeline
TOML is converted to XML via two steps: TOML → JSON (lossless except for comments and datetimes), then JSON → XML. The result is well-formed XML 1.0 with a single root element wrapping all top-level TOML keys as child elements.
Input
title = "My App" version = "1.0.0" [database] host = "localhost" port = 5432
Output
<?xml version="1.0" encoding="UTF-8"?>
<root>
<title>My App</title>
<version>1.0.0</version>
<database>
<host>localhost</host>
<port>5432</port>
</database>
</root>Type mapping
| TOML type | XML output | Notes |
|---|---|---|
| String | <key>value</key> | Text content |
| Integer | <key>42</key> | Serialised as text |
| Float | <key>3.14</key> | Serialised as text |
| Boolean | <key>true</key> | Lowercase string |
| Datetime | <key>2024-01-15T10:30:00Z</key> | ISO-8601 string |
| Array | <key>…</key> × N | Repeated sibling elements |
| Table [x] | Nested child elements | Under <x> parent |
| [[array-tables]] | <x>…</x> × N | Repeated sibling elements |
Warning: TOML key names must be valid XML element names. Quoted TOML keys (e.g.
"my key") that contain spaces or start with digits will produce invalid XML tag names. Rename such keys to use underscores or camelCase before converting.Array of tables
TOML's [[array-of-tables]] — the idiomatic list-of-objects syntax — becomes repeated XML sibling elements. This is the standard XML pattern for homogeneous lists and is compatible with XSLT and most XML-based toolchains.
Input
[[items]] id = 1 name = "Alice" [[items]] id = 2 name = "Bob"
Output
<items> <id>1</id> <name>Alice</name> </items> <items> <id>2</id> <name>Bob</name> </items>
Frequently Asked Questions
Your files stay on your computer. Dad promised.