Convert to TOML

Convert CSV, INI, JSON, NDJSON, TSV, XML, or YAML to TOML. Paste the source or open a local file, then choose the parser settings. The conversion runs in your browser and does not upload the input.

How conversion works

Link

NDJSON lines are collected into an array and written under items. Object records become TOML arrays of tables. Primitive lines become an inline array when their types can be represented together. Blank lines are ignored, while malformed JSON reports the failing line number.

JSON objects and YAML mappings become TOML key-value pairs and tables. Nested objects become named tables. Arrays of objects become arrays of tables. A top-level array is placed under items because a TOML document must have a table at its root. A top-level scalar is placed under value.

CSV and TSV tables become arrays of tables under items when the first row supplies headers. Dots in a header create nested tables, so hello.there.general becomes three nested keys. Columns with the same path are merged into one table. A backslash before a dot is also accepted as a separator. Without headers, each row becomes an array. Type inference converts recognised numbers, booleans, and null values instead of keeping every field as text. TOML cannot store null, so inferred null values produce an error.

INI sections become TOML tables. Keys outside an INI section appear under global, and all INI values remain strings. XML elements become table keys, repeated elements become arrays, and attributes appear under the configured attributes key.

TOML output

Link

The converter writes strings with double quotes, primitive arrays inline, nested objects as tables, and arrays of objects as arrays of tables. It keeps object key order. Keys containing characters outside letters, digits, underscores, and hyphens are quoted.

TOML has no null value. The conversion also rejects non-finite numbers and values that cannot be represented as TOML. Invalid source data produces an error instead of partial output.

What TOML can represent

Link

TOML is a configuration-file format built around key-value pairs and tables. A table groups related keys, dotted keys describe a path, and double brackets create an array of tables.

title = "Example"
enabled = true

[server]
host = "localhost"
ports = [80, 443]

[[users]]
name = "John"

TOML supports strings, integers, floating-point numbers, booleans, date and time values, arrays, and tables. This converter writes date-like source strings as strings. It does not guess that a string is a date.

Tables and arrays of tables

Link

A table heading such as [server] applies to the key-value pairs that follow it. A dotted heading such as [database.connection] creates nested tables. An array-of-tables heading such as [[users]] adds one table to a list, and another heading with the same name starts the next item.

Arrays may contain primitive values or inline tables. TOML expects array items to have compatible types. Source formats can be less strict, so mixed arrays may need manual adjustment for software that validates TOML types closely.

Where TOML is used

Link

TOML is mainly used for configuration files. Rust projects use Cargo.toml for package metadata and dependencies, Python projects can keep build-system and tool settings in pyproject.toml, and several static-site generators use TOML for site configuration. The table syntax works well when people edit the file by hand and the settings need more structure than INI can express.

TOML describes configuration data rather than a stream of application records. JSON, CSV, or a database format is usually a better fit for large datasets, logs, or messages exchanged between services.

What may be lost

Link

Conversion preserves data values where TOML has an equivalent, but it does not preserve comments or source formatting. YAML anchors, aliases, tags, and scalar styles are discarded. XML namespaces, comments, processing instructions, and mixed content cannot be reconstructed faithfully. CSV and TSV contain little type information unless type inference is enabled.

TOML does not support null. JSON or YAML data containing null cannot be converted without choosing a replacement or removing the value. Large numbers pass through JavaScript, which cannot represent every integer above 9,007,199,254,740,991 exactly.

The converter reads the complete input and output into memory. It suits ordinary configuration files and datasets, not very large exports.

Files, privacy, and saved work

Link

Select a local file. A recognised extension selects the matching input type. The browser reads the file locally and does not upload it.

The selected format, each format’s input, and parser settings are stored in localStorage. Switching formats does not overwrite another format’s text. Clear the fields or site data after handling sensitive information on a shared device.

Link

Widget made with staark