INI converter
What is an Ini Converter?
INI files are one of the oldest configuration formats: plain text with [sections] and key=value lines. They are still used by PHP (php.ini), Git (.gitconfig), Python's configparser, systemd units, Windows applications and many games. JSON is easier to process in code and APIs. This converter translates between the two formats.
How to use it
- Paste INI content to get JSON, or paste a JSON object to get INI.
- Check that sections and keys mapped as expected.
- Copy the result.
Example
Input:
; database settings
[database]
host = localhost
port = 5432
[cache]
enabled = trueOutput (with double quotes in real JSON):
{
'database': { 'host': 'localhost', 'port': '5432' },
'cache': { 'enabled': 'true' }
}Each section becomes an object, and keys outside any section become top-level properties.
INI quirks to know
- No standard: INI was never formally specified, so parsers differ. Comments may start with
;or#, and some parsers allowkey: value. - Values are text: numbers and booleans may come out as strings depending on the parser. Convert them in your code.
- Nesting: INI has only one level of sections. Dotted section names such as
[server.http]may be turned into nested objects by some tools and kept literal by others. - Comments are lost when converting to JSON, because JSON has no comment syntax.
- Duplicate keys: most parsers keep the last value.
If you need richer types and nesting with a similar look, consider TOML, which is a strictly specified successor to INI.
Frequently Asked Questions
What is an INI file?
A plain text configuration file made of sections in square brackets and key equals value lines.
Are comments kept when converting to JSON?
No. JSON has no comment syntax, so comments are dropped.
Why are numbers strings in the output?
INI has no data types, so values are text. Your application should convert numbers and booleans.
Should I use INI or TOML?
TOML looks similar to INI but has a strict specification, real data types and nested tables, so it is a better choice for new projects.