INI ⇄ JSON Converter
Convert INI to JSON and back, with sections becoming nested objects.
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
Env File Converter
Convert between .env, JSON and YAML — the same config in three syntaxes.
LocalYAML to JSON Converter
Convert YAML to JSON and back, with what the conversion costs stated rather than dropped.
LocalJSON Formatter & Validator
Format, validate and measure JSON, with errors located by line and column.
LocalTOML to JSON Converter
Parse a TOML document — tables, arrays of tables and all — into JSON.
LocalGitignore Generator & Checker
Generate a .gitignore for common stacks, or check whether a path is actually ignored.
LocalGit URL Parser
Break a git remote URL into protocol, host, owner and repository.
Local