INI to JSON
Convert INI, .cfg and .conf files to JSON and JSON back to INI.
About this tool
Paste an INI file and get JSON, or switch direction to turn a JSON object into INI. Options convert numbers and booleans to real types and nest dotted section names such as [database.pool].
How INI files are parsed
INI is one of the oldest configuration formats, still used by php.ini, Python's configparser, Git's .gitconfig, Windows apps, MySQL's my.cnf, desktop entries and many games. A file is a list of key = value (or key: value) lines grouped under [section] headers. Lines starting with ; or # are comments, and comments can also follow a value. This converter turns each section into a JSON object, nests [database.pool] inside database, keeps quoted values exactly (so a password containing ; or # survives), builds arrays from PHP-style key[] = value lines, and optionally converts true/false, yes/no, on/off and numbers into real JSON types. Converting back, nested objects become dotted sections and arrays become key[] lines. Honest limits: INI has no formal standard, so applications differ on details such as duplicate keys (here the last wins), escaping and multi-line values (not supported). Values with leading zeros such as 007 are kept as text so they aren't corrupted. The .env converter, YAML to JSON and TOML to JSON are related.
Frequently asked questions
How do I convert an INI file to JSON?
Paste it here. Sections become objects and key = value lines become properties.
Are comments supported?
Yes. Lines starting with ; or #, and comments after unquoted values, are ignored.
Can I convert JSON to INI?
Yes. Switch the direction. Nested objects become [section.subsection] headers.
Is my data uploaded?
No. Everything runs in your browser and nothing is stored or sent.