How to convert INI, JSON and YAML settings

Paste a configuration and choose one of the five directions: INI to JSON, INI to YAML, INI to TOML, JSON to INI or YAML to INI. Convert writes the result below the metrics, and Copy or Download saves it as converted-config.json, .yaml, .toml or .ini.

Everything runs in the page: no upload, no request to this site, and the editor keeps working offline. TOML is an output only: the workbench never reads TOML back.

  1. Paste the configuration into the editor, or press Load example for a small INI sample with one section.
  2. Pick the direction: INI to JSON, INI to YAML, INI to TOML, JSON to INI or YAML to INI.
  3. Press Convert. An empty editor, an unreadable JSON or YAML document, or an INI line that is neither a key = value pair nor a [section] header stops the run; the status line names the line and column.
  4. Read the metrics (top-level settings, input lines, input size, output size) and then the findings: merged sections, repeated keys, omitted nulls and values INI cannot hold are listed there.
  5. Press Copy or Download for the converted text, and Clear before the next file.

What the converter keeps, and what it cannot

Reading the INI side

The reader follows the conventions of .ini files: key = value or key: value lines, [section] headers, and ; or # comments. An inline comment starts only where the marker follows a space, so port=8080 ; note keeps 8080 and color=#ff0000 keeps its value. Blank lines are ignored, and every setting after a [section] header belongs to that section.

A value may be quoted: double quotes honour the escapes for backslash, double quote, newline, carriage return, tab and code point, and single quotes are literal. A key that contains =, :, #, ; or brackets has to be quoted the same way. A header may carry a comment, as in [database] ; credentials.

Repeats are merged rather than rejected: a second [database] joins the first, a repeated key keeps its last value, and a section named like an earlier top-level setting replaces it. Each decision is reported in the findings instead of changing the file silently.

Value types: what stays text

A value becomes a number only when JavaScript prints that number back character for character. 8080, -7 and 3.5 are numbers; 007, 0123456789, 1.50, +1, 1e3 and every id beyond 2^53 stay text, so a postcode, a phone number or a version is never rewritten. true and false become booleans, null, nil and ~ become null, and yes, no, on and off stay text.

JSON and YAML keep the types their own parsers produced. On the way into INI, a string that would read back as a number, a boolean or null is quoted ("8080", "true", "null"), and a string holding a comment marker, a leading or trailing space or a line break is quoted with escapes, so the round trip returns the same value with the same type.

What each target keeps

INI to JSON, YAML and TOML keep the structure and the value types. TOML has no null, so a setting whose value is null is left out and named in the findings, and a name that TOML would read differently is quoted: [my section] becomes ["my section"].

JSON to INI and YAML to INI flatten the document to one level. A list or a nested object is written as compact JSON text (tags=["a","b"]) and reported; a top-level list or single value cannot be written as INI and stops the run; an empty document reports that the INI output is empty.

INI has one level of sections, an indented continuation line is not read, and comments from the input are not carried into the output.

Recent tools: