Skip to content
UniKit

INI to JSON

Convert INI configuration files to JSON and back: [section] blocks, both = and : separators, ; and # comments, whitespace trimming, duplicate-key strategies (last wins / error / array) and globals collected into a default section.

Runs in your browserEvery computation happens in your browser — your data never leaves this device.

Result

What this tool does

  • Turn legacy INI files (php.ini, desktop apps, config.ini in build scripts) into JSON you can require straight from Node or a frontend bundle.
  • Write a JSON config back out as INI for older systems and ops scripts that only read INI.
  • Flatten an INI file into JSON while debugging, so you can see every section, key and duplicate at a glance.

Example

Input

name = app

[server]
host = localhost
port = 8080

Output

{
  "default": {
    "name": "app"
  },
  "server": {
    "host": "localhost",
    "port": "8080"
  }
}

Values stay strings; keys written before any section go into the default section.

Frequently asked questions

What happens to duplicate keys?

By default the last value wins, but you can switch to "report error" or "collect into array". Either way the duplicated key names are listed under the result so you can clean the file up.

Are colons or equals signs inside a value treated as separators?

No. Only the first = or : on the line is the separator, everything after it is the value, so URLs like http://a.com?x=1 survive unchanged.

How are nested objects handled when converting JSON back to INI?

One level of nesting becomes a [section] and root-level scalars go into the default section. Deeper nesting, or objects inside arrays, cannot be expressed in INI and raise an error.

Are comments supported?

Yes. Lines starting with ; or # are ignored, while # characters inside a value (colors, URL fragments) are kept.

Keywords:iniini to jsonjson to iniini 转 jsonjson 转 ini配置文件config filesection解析 iniconvert

Related tools