Saved

Press the star next to a tool's name to save it.

All my tools

JSON to INI Converter

This JSON to INI converter turns a JSON object into an INI file with key = value pairs, [sections], flattened nested sections and your choice of array style.

Top-level values become global keys; objects become [sections]. INI sections can't be nested, so deeper objects become [section.sub].

Your JSON is converted in your browser. Nothing is uploaded.

Your INI file

Paste JSON and press Convert to INI.

A JSON to INI converter turns JSON settings into an INI configuration file. Paste a JSON object and this JSON to INI converter writes key = value pairs, puts each object in its own [section], flattens deeper objects into dotted section names, and handles arrays in the style you choose. Copy the result or download it as a .ini file.

What an INI file is

An INI file is a configuration file made of plain text, with key–value pairs organized in sections. The name comes from the .ini filename extension, short for initialization, used in MS-DOS, which popularized this way of configuring software. INI has become an informal standard for configuration in many contexts, though there's no single official specification, so different programs read it in slightly different ways.

Sections

Key–value pairs can be grouped under a section. The section name appears on a line by itself in square brackets, and it applies to every key–value pair that follows until the next section starts. There's no end-of-section marker, so sections can't be nested. When nesting is needed, it's done by flattening the hierarchy and joining names with a delimiter inside the section name, often a dot. The converter follows that convention: an object at server.tls becomes the section [server.tls].

How the JSON is mapped

  • Top-level strings, numbers and booleans become global keys at the start of the file. Some INI readers require every key to be in a section, so put them in an object if yours does.
  • Objects become [sections].
  • Nested objects become sections with dotted names.
  • Arrays become repeated key[] = value lines, a style many readers understand, or a single comma-separated value.
  • null becomes an empty value.
  • Text with special characters, such as ; # = quotes, line breaks or leading spaces, is wrapped in double quotes with quotes and backslashes escaped.

How to use the JSON to INI converter

  1. Paste your JSON object.
  2. Choose how arrays are written.
  3. Choose whether to put spaces around =.
  4. Press Convert to INI, then copy or download the file.

Example

This JSON:

{"owner": {"name": "John Doe", "organization": "Acme Widgets Inc."}, "database": {"server": "192.0.2.62", "port": 143, "file": "payroll.dat"}}

becomes an [owner] section with name = John Doe and organization = Acme Widgets Inc., and a [database] section with server = 192.0.2.62, port = 143 and file = payroll.dat, the same layout as the classic INI example.

Comments and escapes

INI files often contain comments, usually lines starting with a semicolon, which some readers also accept with a hash. JSON has no comments, so there are none to carry over, but you can add them to the INI file afterwards to explain settings. Because ; and # can start comments, values containing them are quoted. Support for escape sequences such as \\ and \" varies between INI dialects, so check how your program reads quoted values.

Choosing the array style

INI has no standard for lists. Repeated key[] = value lines are read as arrays by several popular parsers, including PHP's. A single comma-separated value works with programs that split the value themselves. If you're not sure, check the documentation for the program that will read the file.

Is it private?

Yes. The conversion runs in your browser, and nothing is uploaded.

Global keys and sections

Some INI dialects require every key–value pair to belong to a section, while others allow global properties that appear before the first section. The converter writes top-level simple values as global keys at the very start of the file, which readers that allow them will understand. If the program you're configuring needs everything in sections, wrap those values in an object in your JSON, such as {"general": {"app": "My app"}}, so they're written under [general].

Values are text

Unlike JSON, INI doesn't record whether a value is a number, a true or false value or a string: everything is text, and the program reading the file decides what each value means. So port = 143 and port = "143" usually mean the same thing. The converter writes numbers and booleans without quotes, which is what most programs expect, and quotes text only when it has to.

Where INI files are used

INI files are still common for desktop application settings, game configuration, PHP's own settings file, version-control and editor configuration, and many command-line tools. Their simple sections and key = value lines make them easy to edit by hand, which is why many programs keep using them even when they store data in JSON internally.

Checking the result

Because INI isn't one strict standard, open the file with the program that will read it and check that it picks up every setting. Pay particular attention to arrays, nested sections and quoted values, which are the parts different programs handle differently. If something isn't read correctly, try the other array style or flatten the JSON further.

Common mistakes

  • A top-level array. INI needs keys; use an object.
  • Deep nesting that a reader can't handle; flatten it first.
  • Expecting types. INI values are text; the reading program decides what they mean.
  • Different dialects. Test the file with the program that uses it.

What next

Use this often? Add JSON to INI to your Home screen.

Frequently asked questions

How does the JSON to INI converter work?

It writes simple values as key = value lines, puts each object in a [section], flattens nested objects into dotted section names, and writes arrays the way you choose.

Can INI sections be nested?

No. Nesting is done by flattening names with a delimiter, such as [server.tls].

How are arrays written?

As repeated key[] = value lines, or as one comma-separated value.

What happens to special characters?

Values containing ; # = quotes or line breaks are wrapped in double quotes with escapes.

Is my JSON uploaded?

No. It's converted in your browser.

What went wrong?

We only receive the reason you pick, never what you typed into the tool.

Thanks for your feedback.

More Developer Tools