INI to JSON converter
Paste an INI file to get JSON with one object per section, or switch the direction and paste JSON to get an INI file. Comments starting with ; or # are skipped, quoted values are unquoted, and errors are reported with the line number.
Runs in your browser: nothing you enter is sent anywhere.
How to use it
- Choose the direction.
- Paste the INI file or JSON.
- For INI to JSON, decide whether numbers and booleans should be detected and whether inline comments are allowed.
- Copy the result.
Example
[server]
port = 8080 ; main port
debug = true
becomes
{"server": {"port": 8080, "debug": true}}
Tips
Turn off inline comments if a value legitimately contains # or ; after a space, such as a color or a URL fragment written with a space before it. A ; or # not preceded by a space is always part of the value.
Frequently asked questions
Which INI syntax is read?
Section headers in brackets, key = value or key: value pairs, whole-line comments starting with ; or #, optional inline comments, and values wrapped in double or single quotes. Keys before the first section go to the top level of the JSON. A repeated key keeps the last value.
Why are some numbers not converted?
With type detection on, only true, false and plain decimal numbers such as 8080 or 9.5 are converted. Values like 007, 1.5e3 or 0x1F stay as text, so identifiers are not changed. Turn detection off to keep every value a string. Quoted values are always text.
How do arrays work?
Repeat a key that ends in [], for example include[] = lib and include[] = vendor, and they are collected into an array. Going back, arrays of values are written the same way.
What happens to nested JSON?
INI has one level of sections. When writing, a nested object becomes a section named with dots, such as [db.opts]. When reading, a header like [db.opts] is kept as the flat key "db.opts", not as nested objects.
Is there one official INI format?
No. Parsers differ on comments, quotes, escapes and duplicate keys. This tool follows the common rules described here, so check the result against the program that will read your file.