Skip to main content
QUIETLYTIC
Developer

INI ⇄ JSON Converter

Convert INI to JSON and back, with sections becoming nested objects.

Local · nothing leaves this browser Waiting for input
Esc Clear
Output

Paste input on the left.

How it works

INI has no formal specification — PHP's, Python's and Windows' own readers all disagree at the edges — so this follows the common-denominator reading every one of them agrees on: ; and # both start a comment, a [section] header groups the keys under it until the next header, and keys before any header belong to a root section.

One level of sections, not a hierarchy

A section becomes one nested object; a key before any header sits at the top level. Some INI dialects treat a dotted section name like [a.b] as two levels of nesting — this does not guess at that convention, because a name is either a literal section name or a path depending entirely on which reader is meant to consume it, and nothing in the file itself says which.

JSON → INI needs exactly two levels

Converting the other way, a value must be a scalar (goes to the root) or a flat object of scalars (becomes a section) — a section cannot itself contain a section, and an array has no native INI representation, so both fail with the specific key at fault rather than silently reshaping your data.

Example

[server] host = localhost port = 8080 converts to {"server":{"host":"localhost","port":"8080"}} — every INI value comes through as a string, since INI carries no type information any more than CSV does.

Frequently asked questions

Which comment styles does it accept?

Both ; and #, which between them cover every common INI reader — Python's configparser defaults to ;, PHP's parse_ini_file accepts both, and Windows .ini files traditionally use ;. Either one is treated as starting a comment for the rest of the line.

Why does every converted value come through as a string?

Because INI carries no type information, the same limitation this site's CSV ⇄ JSON Converter documents for CSV. A key holding port = 8080 cannot be told apart from port = "8080" in the source text, so casting it to a number would be a guess, not a read.

What happens to a key set twice in the same section?

The last occurrence wins and the earlier one is silently dropped, matching how the .env Validator treats a duplicate key — it is the behaviour of most real INI readers, not a limitation specific to this tool.

Related tools

From the intelligence desk