FormatterHQ

JSON to INI Converter

Turn a JSON object into an INI configuration file. Top-level values stay global, nested objects become [sections] and dotted sub-sections, and arrays are written as key[] lines.

Input JSON
Output INI
Ready.

How to use the JSON to INI Converter

  1. Paste a JSON object into the input editor. The top level must be an object, not an array.
  2. Click Convert.
  3. Review the section headers and quoted values in the output.
  4. Copy the result or download it and save it with an .ini or .cfg extension.

Write INI files with the JSON to INI converter

The JSON to INI converter maps a JSON object onto the section-and-key layout of an INI file. Scalar values at the top level are written first as global keys, every nested object becomes a [section], deeper objects become dotted sections such as [server.tls], and arrays are written as repeated key[] = value lines, the PHP convention.

It is handy when you keep settings in JSON but need to produce a php.ini fragment, a setup.cfg, a game or desktop-app config, or any legacy tool that only reads INI.

Example

Input:

{
  "title": "Acme",
  "server": {
    "host": "0.0.0.0",
    "ports": [80, 443],
    "tls": { "cert": "/etc/ssl/a.pem", "enabled": true }
  },
  "db": { "password": "p;ss#1", "note": null, "empty": "" },
  "logging": { "file": { "path": "/var/log/app.log" } }
}

Output:

title = Acme

[server]
host = 0.0.0.0
ports[] = 80
ports[] = 443

[server.tls]
cert = /etc/ssl/a.pem
enabled = true

[db]
password = "p;ss#1"
note =
empty = ""

[logging.file]
path = /var/log/app.log

How the mapping works

  • Section headers are only written when needed. logging has no values of its own, so the output jumps straight to [logging.file] instead of printing an empty [logging].
  • Quoting: values containing ;, #, = or ", values with leading or trailing spaces, and empty strings are wrapped in double quotes so INI parsers do not treat part of them as a comment.
  • null becomes an empty value (note = ), while "" is written as "" so the two stay distinguishable.
  • Numbers and booleans are written as plain text; INI has no types, so the reading program decides how to interpret them.

Edge cases

  • Top-level arrays are rejected with "INI needs a JSON object at the top level", since INI has no way to represent a list of documents.
  • Objects inside arrays cannot become sections, so they are stored as JSON text: list[] = "{\"x\":1}". Restructure the data if the target app needs real sections.
  • Dotted section names are a convention. PHP's parse_ini_file and Python's configparser read [server.tls] as a single section with a dot in its name, which is usually what you want.

To go the other way, use INI to JSON. If you are free to choose the format, JSON to TOML gives you INI-like syntax with real types and nested tables. Validate your source first with the JSON validator.

Privacy

The conversion runs in your browser; your configuration is not uploaded.

Frequently asked questions

How are nested JSON objects represented in INI?
Each nested object becomes a section, and deeper objects become dotted sections like [server.tls]. Scalar values at the top level are written before the first section as global keys.
How does the converter write JSON arrays?
Arrays of simple values become repeated key[] = value lines, which PHP's parse_ini_file reads back as arrays. Objects inside arrays are stored as quoted JSON text because INI cannot nest them.
Why are some values wrapped in quotes?
Characters such as ; and # start comments in many INI dialects, and = separates keys from values. Quoting those values, plus empty strings and values with surrounding spaces, keeps them intact when the file is read.
Can I convert the INI back to the same JSON?
Mostly. INI to JSON restores sections, arrays and, with typed conversion on, numbers and booleans. null values come back as empty strings because INI has no null.

Last updated September 26, 2026

Related tools

INI to JSON Converter Convert INI configuration files (php.ini, .gitconfig, setup.cfg style) to JSON with sections, arrays and typed values. JSON to Properties Converter Convert JSON into Java .properties key=value lines with dotted keys and correct escaping of special and non-ASCII characters. JSON to Query String Build URL-encoded query strings from JSON objects, with a choice of bracket, indexed or repeated keys for arrays. JSON to SQL Converter Convert JSON to SQL online for free. CREATE TABLE and INSERT statements with escaped values. JSON to Text Converter Convert JSON to Text online for free. Readable key: value output for reports and tickets. JSON to TOML Converter Convert JSON to TOML online for free. Tables and arrays of tables are generated for you. JSON to TSV Converter Convert JSON to TSV online for free. Paste the result straight into a spreadsheet. JSON to XML Converter Convert JSON to XML online for free. Attributes, arrays and root element are configurable. JSON to YAML Converter Convert JSON to YAML online for free. Clean, readable YAML with configurable indentation. OPML to JSON Converter Convert OPML to JSON online for free. Get formatted JSON with types detected automatically. PDF to JPG Converter Convert PDF pages to JPG images (or PNG and WebP) at 72–300 DPI. Download single pages or all pages as a ZIP. Runs in your browser. PDF to Text Converter Extract all the text from a PDF, page by page, as plain text you can copy or download as .txt. Choose pages; works in your browser.