How to use the json to ini converter
- Paste your JSON text into the input area.
- The tool parses the JSON and converts it to INI format automatically.
- Top-level strings, numbers and booleans appear as root key-value pairs.
- Nested objects become
[section]headers with their own keys. - Copy the resulting INI text for use in your configuration files.
How the conversion works
The json to ini conversion follows a straightforward mapping from JSON data types to INI syntax. A top-level JSON object is required because INI files consist of key-value pairs grouped into sections.
Primitive values such as strings, numbers and booleans at the root level are written directly without a section header. For example, {"name": "app", "port": 8080} becomes:
name = app
port = 8080
When the parser encounters a nested object, it creates a new section using the parent key as the section name. The object {"database": {"host": "localhost", "port": 5432}} produces:
[database]
host = localhost
port = 5432
Keys within each object are processed in their original insertion order, ensuring deterministic output every time you convert.
Handling arrays, null and special characters
Standard INI format does not have a native array type. This converter serializes JSON arrays as comma-separated values. An array like [80, 443, 8080] becomes ports = 80, 443, 8080. String arrays work the same way: ["a", "b"] outputs items = a, b.
The JSON null value is written as the literal string null, and booleans become true or false. Unicode characters are preserved exactly as they appear in the JSON source. If your JSON contains "caf\u00e9", the INI output will contain the actual character café.
Line breaks inside a string value are written as the two characters backslash and n so each entry stays on one line. Values that contain equals signs or leading spaces are written as-is. Most INI parsers read everything after the first = as the value, trimming optional surrounding whitespace.
Common INI structure reference
The table below shows how typical JSON structures map to INI syntax when you convert json to ini.
| JSON Input | INI Output |
|---|---|
{"key": "value"} | key = value |
{"num": 42} | num = 42 |
{"flag": true} | flag = true |
{"empty": null} | empty = null |
{"list": [1, 2]} | list = 1, 2 |
{"sec": {"k": "v"}} | [sec] |
This mapping covers the vast majority of configuration scenarios. Deeply nested objects beyond one level are flattened by joining the keys with dots, so {"a": {"b": {"c": 1}}} becomes [a.b] followed by c = 1.
When to use INI over JSON
INI files remain popular for desktop application settings, game engine configurations and simple server setups where human readability is more important than complex data modeling. Many legacy systems and tools expect an INI file rather than JSON.
If you need to exchange data between web services, JSON is usually the better choice. But when configuring software that reads .ini or .conf files, converting your structured data into the INI format saves manual typing and prevents syntax errors.
For other configuration formats, you might also need to convert your data further. Tools like json to xml or json to toml handle those specific targets. If you are generating code models instead of configuration files, converters for json to go struct, json to python class or json to java class are available on this site.
Limitations and edge cases
The INI format is intentionally simple, which means some JSON features do not translate perfectly. Objects inside arrays cannot be represented cleanly in standard INI syntax. If your JSON contains an array of objects, each object is written as compact JSON inside the comma-separated list, so consider flattening the data before converting if you need plain values.
The root input must be a JSON object. Passing a bare array, string or number will result in an error because there are no keys to map to INI entries. Empty objects produce empty output, which is valid but results in a blank file.
Section names containing brackets or newline characters may confuse strict INI parsers. While this converter writes them as-is, it is best practice to keep JSON keys intended for section names simple and alphanumeric.
Worked examples
| Example | Input | Result |
|---|---|---|
| Simple application config | JSON input: {"app":"myapp","version":"1.0.0","debug":true} | app = myapp / version = 1.0.0 / debug = true |
| Database connection settings | JSON input: {"database":{"host":"localhost","port":5432,"name":"mydb","ssl":false}} | [database] / host = localhost / port = 5432 / name = mydb / ssl = false |
| Arrays and mixed types | JSON input: {"server":{"ports":[80,443,8080],"hosts":["example.com","test.com"],"timeout":null}} | [server] / ports = 80, 443, 8080 / hosts = example.com, test.com / timeout = null |
FAQ
What happens to nested JSON objects?
Nested objects become INI sections. A key like "database" containing an object will produce a [database] header, with the inner keys listed beneath it.
How are JSON arrays converted?
Arrays are joined into a comma-separated list. For example, [1, 2, 3] becomes "key = 1, 2, 3" in the INI output.
Can I convert a JSON array directly to INI?
No, the root element must be a JSON object. INI files require key-value pairs, so a bare array has no keys to map.
How are null and boolean values handled?
Null is written as the literal string "null". Booleans are written as "true" or "false" without quotes.
Is my data sent to a server?
No. The json to ini conversion runs entirely in your browser using JavaScript. Nothing is uploaded anywhere.
Does the converter preserve key order?
Yes. Keys are output in the exact order they appear in the parsed JSON object, ensuring deterministic results.
Are deeply nested objects supported?
Objects nested more than one level deep are flattened by joining the path with dots. For example, a nested path a.b.c creates a section named [a.b] with the key c inside it.