Skip to content
uencoder
TASK

Use TOML arrays and array of tables

TOML supports arrays of primitives and arrays of tables. Learn the syntax for inline arrays, multi-line arrays, and [[table]] arrays for structured data.

  1. 1

    TOML arrays: inline ([1, 2, 3]) or multi-line (one element per line with trailing comma). Array of tables uses [[table]] — each occurrence appends a new element to the array. This is useful for lists of structured objects (e.g., [[servers]] with name, host, port).

  2. 2
    TOML Converter →

    Parse the TOML file and convert to JSON to verify array structures. Inline arrays become JSON arrays; [[table]] becomes an array of objects. The conversion makes the structure explicit and easy to inspect.

  3. 3
    JSON Formatter →

    Format the converted JSON to see the array structure clearly. Arrays of tables become arrays of objects — verify the nesting and element count. This is useful for debugging TOML parsing issues.

  4. 4
    toml-convert → json-format

    Use the TOML-to-JSON workflow to parse, convert, and format in one step. This validates the TOML syntax and shows the resulting structure.

  5. 5

    TOML array syntax: inline = [1, 2, 3], multi-line = [ 1, 2, 3 ], array of tables = [[product]] name = "A" [[product]] name = "B". Mixed-type arrays are allowed in TOML 1.0 but discouraged. Use arrays of tables for lists of configuration objects (servers, endpoints, features).

Frequently asked questions

Can TOML arrays contain mixed types?
TOML 1.0 allows mixed-type arrays: [1, "two", true]. However, this is discouraged — it makes parsing and validation harder. Use homogeneous arrays (all strings, all integers, all tables) for clarity and type safety.
How do array of tables differ from inline arrays of tables?
[[table]] creates an array of tables by appending each occurrence. You can also write inline: products = [{name = "A", price = 1}, {name = "B", price = 2}]. The [[table]] form is preferred for readability with many fields; inline is fine for short entries.

Workflows that solve this

Compare two YAML configs via JSON
Convert YAML configs to JSON for diff-friendly comparison of structured values.
PIPELINE
Encode a JSON payload for URL transport
Prepare a JSON document for a URL parameter: pretty-print, Base64-encode, then percent-encode — the exact inverse of the nested-parameter decode chain.
PIPELINE
HJSON to JSON Format
Format HJSON then convert to standard JSON.
PIPELINE
Format JSON and compute integrity checksum
Pretty-print a JSON document and compute a CRC32 checksum to detect any subsequent modifications.
PIPELINE
Minify and validate JSON
Format JSON for inspection and validate it is syntactically correct in one pass.
PIPELINE
Format JSON and generate TypeScript interface
Format a JSON document then infer a TypeScript interface definition in one chain.
PIPELINE
Validate, format, then convert JSON to YAML
Convert a (possibly minified) JSON config to YAML, catching syntax errors at the first node instead of producing subtly wrong YAML.
PIPELINE
JSON5 to JSON Format
Format JSON5 then convert to standard JSON.
PIPELINE
JSONC to JSON Format
Format JSONC (JSON with comments) then convert to standard JSON.
PIPELINE
Decode and format a JWT payload
Parse a JWT token, extract its payload, and format the JSON for inspection.
PIPELINE
Parse Query String and Format JSON
Parse query string into key-value pairs then format as JSON.
PIPELINE
Convert TOML to JSON
Parse a TOML configuration file into JSON for tools and APIs that expect JSON input.
PIPELINE
TOML to JSON to CSV
Convert TOML to JSON then to CSV for data export.
PIPELINE
Convert TOML to JSON then YAML
Transform a TOML config into YAML via JSON for Kubernetes or CI tooling.
PIPELINE
Convert TOML to YAML via JSON
Transform a TOML configuration file into YAML format, using JSON as an intermediate representation.
PIPELINE
Decode nested URL parameter (Base64 JSON)
Unwrap a URL parameter that carries URL-encoded Base64 JSON into readable, formatted JSON.
PIPELINE
Generate TypeScript interfaces from YAML
Convert a YAML document to TypeScript interface definitions, using JSON as an intermediate format.
PIPELINE

Learn more

Want to understand why?

Related tools