Embed this tool on your site
About this tool
INI is the oldest config format still in active use — php.ini, my.cnf, .gitconfig, and hundreds of legacy apps all use it. Sections in square brackets contain flat key=value pairs. This converter maps the common subset to and from JSON. Each [section] becomes a top-level JSON object, and keys that appear before any section are placed at the JSON root. Lines starting with ; or # are skipped as comments. Values are typed automatically: true and false (any case) become booleans, null becomes null, and plain decimal numbers become JSON numbers — so 02139 becomes 2139. Everything else, including quotes and any trailing ; comment, is kept as written. Going from JSON to INI, the root must be an object holding plain values or one level of section objects; arrays and deeper nesting are rejected with an error, and lines are written as key=value without spaces or quotes. Sysadmins with production passwords in my.cnf and developers with API tokens can use this safely — no data leaves the browser.
Why use it
[section] → JSON Object: Each INI [section] header becomes a top-level JSON key whose value is an object of that section's key-value pairs. The mapping is always predictable: [database] becomes {"database": {"host": ..., "port": ...}} — no ambiguity.
Comment Lines Skipped: Full lines starting with ; or # are ignored when converting to JSON, so both PHP-style and Unix-style comment lines are handled.
Automatic Typing: true and false (in any case) become JSON booleans, null becomes null, and plain decimal numbers become JSON numbers, so ports and limits come out ready to use.
Strict About Structure: JSON → INI accepts plain values and one level of sections only. Arrays and deeper nesting stop with a clear error instead of producing an INI file your reader would misinterpret.
Section-less Keys Supported: Top-level keys appearing before any [section] header are placed at the JSON root object, matching how PHP's parse_ini_file() and Python's configparser both interpret global keys. No data is lost and no extra wrapper object is added.
Browser-Local Privacy: Database passwords inside my.cnf, authentication tokens in app.ini, and API keys in any config file stay entirely on your machine. No upload, no logging, and no network request is made during conversion.
How to use
- Paste JSON into the JSON box or INI into the INI box
- Click JSON → INI to fill the INI box, or INI → JSON to fill the JSON box
- Read any error message, such as 'Arrays are not supported in INI output.'
- Use Swap to exchange the two boxes or Clear to empty both
- Click Copy JSON or Copy INI to grab the result
When it helps
- Converting a MySQL my.cnf or php.ini configuration to JSON for programmatic inspection or modification
- Migrating a legacy INI-based application configuration to a modern JSON config format
- Generating INI config files from flat JSON data produced by an API or configuration management tool
- Porting a Windows application's INI settings into a cross-platform JSON configuration system
- Comparing two INI configs by converting both to JSON and using a JSON diff tool
Examples
Input[client]
port = 3306
socket = /tmp/mysql.sock
[mysqld]
user = mysql
bind-address = 127.0.0.1
max_connections = 200
Expected result · Scroll for more{
"client": {
"port": 3306,
"socket": "/tmp/mysql.sock"
},
"mysqld": {
"user": "mysql",
"bind-address": "127.0.0.1",
"max_connections": 200
}
}
Input{
"app": { "name": "reporter", "debug": true },
"smtp": { "host": "mail.local", "port": 587 }
}
Expected result[app]
name=reporter
debug=true
[smtp]
host=mail.local
port=587
Inputversion = 2
log_level = info
[server]
port = 8080
Expected result{
"version": 2,
"log_level": "info",
"server": {
"port": 8080
}
}
Tips
- INI does not support nesting beyond one level — flatten deeper JSON objects into section names yourself before converting to INI.
- Comments in INI are valuable documentation for non-obvious config values; copy them out before converting if the reasoning behind a value matters.
- Numbers are always converted, so values with leading zeros (ZIP codes, account numbers) lose them in JSON — fix those fields by hand after converting.
- INI files lack a formal specification — double-check that your output works with your specific reader (PHP, Python configparser, or Git) after conversion.
- Remove trailing ; comments from value lines before converting, or they will end up inside the JSON values.
Frequently Asked Questions
What does an INI section become in JSON?⌄
Each [sectionName] header becomes a top-level key in the JSON object. The key-value pairs under that section become properties of a nested object. For example, [database] with host=localhost becomes {"database": {"host": "localhost"}}.
Are comments preserved when converting INI to JSON?⌄
No. Whole lines starting with ; or # are dropped because JSON has no comment syntax, and no warning is shown. A comment after a value on the same line (port = 80 ; web) is not removed — it stays part of the value.
How are nested objects (more than one level) handled?⌄
They are rejected. INI only supports one level of sections, so JSON → INI stops with 'Nested objects deeper than one section level are not supported.' Flatten deeper objects yourself before converting.
Which values become numbers or booleans?⌄
Always: true and false in any case become booleans, null becomes null, and values like 42, -7 or 3.5 become numbers. There is no option to turn this off, so a ZIP code such as 02139 becomes 2139 and yes, no, on and off stay strings.
Does it work for php.ini and my.cnf style configs?⌄
For the common key = value lines, yes: both ; and # comment lines are skipped and spaces around = are trimmed. Keys must use =, not :, and quoted values keep their quotes.
What if my INI has duplicate keys in the same section?⌄
INI has no formal spec for duplicates. The converter uses last-value-wins semantics — if the same key appears twice in a section, the second value overwrites the first. Some parsers (like Python's configparser) do the same.
Are values with spaces wrapped in quotes automatically?⌄
No. JSON → INI writes every line as key=value exactly, with no quoting or escaping, and null as the word null. Add quotes by hand if your INI reader needs them.
Is my data uploaded anywhere?⌄
No. The conversion runs entirely in your browser using JavaScript string processing. No data is sent to any server. Production database passwords, API keys, and other secrets in your config files are safe to paste.
Glossary
- [Section] header
- A line in an INI file containing a name enclosed in square brackets, such as [database]. All key-value pairs that follow belong to this section until the next section header appears.
- Key-value pair
- The fundamental unit of an INI file: a key name, an equals sign (or colon in some dialects), and a value — for example host=localhost or port=3306.
- Comment marker (; / #)
- A character that starts a comment line in INI files. Semicolons are used by PHP's php.ini and Windows apps; hash marks are used by Unix-style configs like my.cnf and .gitconfig. Both are stripped during JSON conversion.
- Quoted string
- A value enclosed in double or single quotes in an INI file, allowing spaces and special characters. Some INI readers strip the quotes; this converter keeps them as part of the value.
- Section-less / global keys
- Key-value pairs appearing before the first [section] header in an INI file. These are treated as belonging to the global scope and are placed at the top level of the JSON output object.
- Configparser dialect
- The specific INI flavour used by Python's built-in configparser module, which supports interpolation (%(key)s references), multiline values using indentation, and both = and : as key-value separators.
A LITTLE HELP. A LOT DONE.
Good tools.
Great flow.
Your shortcut to the everyday. Create, convert, calculate,
and get back to what you love.
✳
✳
✓ Free to use✓ No sign-up✓ 500+ possibilities