Convert JSON Back to INI Format

Convert a JSON object into well-formatted INI configuration output. Covers section generation, array handling, nested object flattening, and comment restoration.

Advanced

Detailed Explanation

JSON to INI Conversion

The reverse direction — converting JSON to INI — is essential for generating configuration files from structured data. The converter handles nested objects, arrays, and various value types to produce valid INI output.

Example JSON

{
  "app_name": "MyService",
  "version": "2.0",
  "database": {
    "host": "db.example.com",
    "port": 5432,
    "ssl": true,
    "pool": {
      "min": 5,
      "max": 20
    }
  },
  "allowed_origins": ["https://example.com", "https://app.example.com"],
  "logging": {
    "level": "info",
    "outputs": ["stdout", "/var/log/app.log"]
  }
}

Generated INI

app_name=MyService
version=2.0

[database]
host=db.example.com
port=5432
ssl=true

[database.pool]
min=5
max=20

[logging]
level=info
outputs=stdout
outputs=/var/log/app.log

Conversion Rules

  1. Root-level primitives: Placed before any section as global key-value pairs
  2. Root-level objects: Each becomes an INI section with [name] header
  3. Nested objects: Use dot notation for section names ([database.pool])
  4. Arrays of primitives: Each element gets its own line with the same key
  5. Booleans: Converted to true/false strings
  6. Numbers: Written as-is
  7. Strings: Written without quotes unless they contain special characters

Root-Level Arrays

Root-level primitive values and arrays that are at the top level appear before any section header. Arrays produce repeated keys:

allowed_origins=https://example.com
allowed_origins=https://app.example.com

Limitations

  • Arrays of objects cannot be represented in standard INI format
  • Null values are written as empty strings
  • Very deeply nested JSON may produce long section names with many dots

Use Case

Generating configuration files for legacy applications that only read INI format, from a JSON-based configuration management system, CI/CD pipeline, or cloud infrastructure template.

Try It — INI \u2194 JSON Converter

Open full tool