INI Converter

Convert INI to JSON or YAML, or write a flat JSON object back as INI.

A section file and a tree

INI is a list of key = value lines, with optional [section] headers. This page reads that into JSON or YAML, or writes a shallow JSON object back to INI. Nested objects and arrays are not an INI file here. YAML from a JSON document is JSON to YAML.

How to use it

  1. Paste INI or JSON into the box.
  2. Mode chooses INI to JSON, INI to YAML, or JSON to INI.
  3. Cast bare numbers and booleans is on by default. A bare 3306 becomes a number, true becomes a boolean, and null becomes null. A value in quotes stays a string, so "3306" stays text. Turn the box off to keep every unquoted value as text too.
  4. Convert writes the result. Show Example loads title = Notes, a blank line, [db], host = localhost and port = 3306, and sets Mode to INI to JSON. Clear All empties both boxes. Copy Result copies the output.

What the conversion keeps

Blank lines and lines starting with ; or # are skipped. A section name becomes an object. Keys before the first section stay at the top. A later line with the same key in the same section wins. JSON to INI accepts an object whose values are strings, numbers, booleans, null, or objects of those scalars. An array, or an object inside a section, is rejected. JSON to INI does not add quotes around values. INI to YAML uses the same object as INI to JSON, then writes YAML. There are no continuation lines and no nested [section.sub] objects.

Where people use it

  • Reading a config into a script.
  • Turning a settings file into YAML.
  • Writing a flat settings object back out as INI.

Questions

port became a number and I needed the text 3306.

Quote it in the INI, or turn off Cast bare numbers and booleans.

An array failed on the way to INI.

This page only writes one level of sections. Arrays have no INI shape here.