Skip to content
ToolPlankDEV
JSON Tools
100% In-Browser Execution

Updated:

INI to JSON Converter

Paste an INI or .cfg file and get JSON as you type. This ini to json converter handles sections, nested section names, quoted values, comments, key[] lists and repeated keys, keeps big numbers and leading zeros exact, and names every line it had to skip. Nothing is uploaded.

Options:

INI

Input
0 chars · 0 lines

JSON

Ready
Processing in browser...
0 chars · 0 linesUpdates as you type

Summary and warnings

Section and key counts, typed values and any skipped lines appear here once there is a result.

Processed on your device. Your text is not sent to our servers.

More free tools you may need next.

Quick Guide

How to use INI to JSON

Simple step-by-step instructions to get the exact output you need.

  1. 01

    Paste or open your INI file

    Paste the file into the left box, press Paste, or open a .ini, .cfg, .conf or similar file. Example loads a small app config. The php.ini, git config, EditorConfig, Windows INI and Broken buttons load samples of each style.

  2. 02

    Read the JSON and the summary

    The JSON appears on the right as you type. The summary panel counts sections, keys and typed values, and lists every skipped line, repeated key and clash with its line number.

  3. 03

    Match the options to your dialect

    Choose whether [a.b] becomes nested objects, how values are typed, what happens to repeated keys, how lists and comments are read, and whether multi-line values are allowed. Strict mode stops at the first bad line instead of skipping it.

  4. 04

    Copy or download the result

    Pick the indent or minified output, sort keys if you want, then press Copy or Download to save the result as config.json.

How to convert INI to JSON

An INI file stores settings as key = value lines grouped under [section] headers. JSON stores the same data as objects. To convert INI to JSON, the tool turns each section into an object, each key into a property, and keys that appear before the first section into properties at the top level.

Section names with dots become nested objects by default. This input:

ini
[app]
name = shop

[app.cache]
ttl = 300

[app.cache.redis]
host = 127.0.0.1

gives this JSON. The 300 became a number, and the IP address stayed text because it is not a plain number:

JSON
{
  "app": {
    "name": "shop",
    "cache": {
      "ttl": 300,
      "redis": {
        "host": "127.0.0.1"
      }
    }
  }
}

Everything runs in your browser, so config files with passwords or tokens are not uploaded. See the Privacy Policy.

How the INI parser reads each line

Each line is read on its own, in order. The rules are the ones most INI readers share:

  • A line in square brackets starts a section. A comment may follow the closing bracket.
  • A key and value are split at the first = or :, so url = http://host:80/ keeps the colons in the value. Spaces around the key and value are trimmed.
  • Lines that start with ; or # are comments and are left out, because JSON has no comments.
  • A value in double quotes keeps its spaces and can hold ; and #. Escapes such as \n, \t, \" and \u00e9 are decoded. A value in single quotes also keeps its spaces and any ; or #, and the quotes are removed, but backslashes inside stay exactly as written, so \n stays a backslash and an n.
  • A quoted value can run over several lines until the closing quote.
  • A byte order mark at the start is ignored, and Windows (CRLF), Unix (LF) and old Mac (CR) line endings all work, even mixed in one file.

When a line cannot be read, such as a header with no closing bracket or a line that starts with =, the tool skips it and adds a warning with the line number. The rest of the file still converts.

INI dialects: php.ini, git config, .editorconfig and Windows INI

INI has no single standard. Each program that reads it set its own rules, and the options here exist to match them. The common cases:

  • php.ini uses ; for comments, On and Off for switches, and extension[] = curl lines to build a list. Keep the default Lists setting and Full detect values.
  • git config writes subsections as [remote "origin"] and indents keys with a tab. The quoted part becomes its own nested object, and its case is kept. A key with no = sign means true, which is the default for Keys without =.
  • .editorconfig uses file patterns such as [*.md] and [*.{js,ts}] as section names. Names with * ? { or } are kept whole, so the dot in *.md does not create a nested object.
  • Windows INI files read by GetPrivateProfileString use ; comments and no escapes. Keys often contain spaces, such as Window Position, and that is fine here.
  • Python configparser files can continue a value on indented lines. Choose Quotes and indented lines under Multi-line values for those.

Here is a short php.ini with a list, using the defaults:

ini
[PHP]
engine = On
memory_limit = 256M
extension[] = curl
extension[] = gd

[Date]
date.timezone = "Europe/Berlin"
JSON
{
  "PHP": {
    "engine": true,
    "memory_limit": "256M",
    "extension": [
      "curl",
      "gd"
    ]
  },
  "Date": {
    "date.timezone": "Europe/Berlin"
  }
}

Dots inside key names, such as date.timezone, are never split. Only section names are nested.

Type conversion pitfalls

INI values are text. Turning them into JSON numbers and booleans is a guess, and some guesses are wrong. Look at this file with Full detect:

ini
country = NO
zip = 01234
version = 1.10
id = 9007199254740993
retries = 3
enabled = yes
JSON
{
  "country": false,
  "zip": "01234",
  "version": "1.10",
  "id": "9007199254740993",
  "retries": 3,
  "enabled": true
}

The country code NO became false, because no is a boolean word in many INI dialects. Switch Values to Numbers, true, false, null only and it stays "NO", while yes stays "yes". The other values show the safety rules that always apply:

  • A leading zero, as in 01234, keeps the value as text so zip codes and IDs keep their zero.
  • A decimal with a trailing zero, as in 1.10, stays text so version numbers do not turn into 1.1.
  • A whole number larger than 9007199254740991 stays text, because JSON readers in JavaScript would round it.
  • Forms such as 1e5, 0x1F and +5 stay text. Quoted values are always text.

The Kept as text list names each value that looked like a number but was left as a string, with its line.

Nested sections or flat section names

Nest at dots is right when a program will read the JSON as a tree. Nest at dots and slashes also splits [a/b]. Keep names flat when the section names are labels rather than paths. With flat names, the first example becomes:

JSON
{
  "app": {
    "name": "shop"
  },
  "app.cache": {
    "ttl": 300
  },
  "app.cache.redis": {
    "host": "127.0.0.1"
  }
}

Nesting can clash. If the file sets a = 1 and later opens a section named [a], a cannot be a value and a section at once. The first one stays, the keys under the clashing part are skipped, and the warning names both lines. Flat names never clash this way.

Repeated keys, repeated sections and strict mode

A key that appears twice in one section is common in hand-edited files. Last wins matches most readers. First wins keeps the earlier value. Collect into an array keeps both, so two port lines give one array that holds 8080 and 9090. Stop with an error refuses to convert and names the lines:

Text
Line 3: "port" in [server] is already set on line 2. Set Duplicate keys to Last wins, First wins or Collect into an array to convert this file.

A section that appears twice is merged into the first one by default. Name case set to Lowercase makes Port and port the same key, which matches git config and Windows INI, where names are not case sensitive.

Lists and multi-line values

By default, key[] = value adds to a list and key[name] = value builds an object, as php.ini does. Choose key[] and split on commas to also turn comma lists into arrays, with each item typed on its own:

ini
[cluster]
hosts = web1, web2, 10.0.0.5
ports = 80,443
JSON
{
  "cluster": {
    "hosts": [
      "web1",
      "web2",
      "10.0.0.5"
    ],
    "ports": [
      80,
      443
    ]
  }
}

Comma split is off by default because many values hold commas that are not lists, such as Window Position=120,80. For long values, Quotes and trailing backslash joins a line that ends in \ with the next one. Quotes and indented lines joins indented lines with a line break, as Python does. Do not use the indented mode for git config, where every key is indented.

The tool reads files up to 2,000,000 characters and section names up to 100 levels deep. It does not expand variables such as ${HOME} or %(name)s, and it does not follow include lines. Inline comments need a space before the ; or #, so a value like #fff or a;b is kept.

If your section headers use double square brackets, the file is TOML, and TOML to JSON is the right tool. Java settings files belong in Properties to JSON, and YAML configs in YAML to JSON. To turn the result into YAML, use JSON to YAML.

Frequently Asked Questions

Technical Q&A for INI to JSON

Common questions about edge cases, character encoding, and privacy guarantees.

Paste the file or open it with the upload button, and the JSON appears as you type. Each section becomes an object, and keys before the first section go at the top level. Press Copy or Download when it looks right.

No. INI has no single standard, so php.ini, git config, Windows INI and Python configparser differ in comments, quotes, lists and case. The options let you match the reader your file was written for.

Full detect reads yes, no, on and off as booleans, as php.ini and many other dialects do. Set Values to Numbers, true, false, null only to keep those words as text, or Keep everything as text to turn off typing.

Yes. Numbers with a leading zero, decimals with a trailing zero and whole numbers above 9007199254740991 stay as strings, so no digit changes. The Kept as text list shows each one with its line.

By default each dot starts a nested object, so [database.replica] becomes a replica object inside database. Choose Keep names flat to keep the whole name as one key, or Nest at dots and slashes to split at / as well.

Yes. Subsections such as [remote "origin"] become nested objects with their case kept, tab-indented keys are read normally, and a key with no = sign becomes true, as git reads it.

By default the last value wins and a warning names both lines. You can keep the first value instead, collect every value into an array, or stop with an error.

No, because JSON has no comment syntax. Full-line comments starting with ; or # are always removed, and the summary says how many. Inline comments after a space are removed too, unless you turn them off.

It could not be read as a section or a key and value, for example a header with no closing ] or a line that starts with =. The Warnings list shows the line number and the reason. Turn on Strict mode to stop at the first such line.

No. The conversion runs in your browser and the file is not sent to a server, so it is safe to paste configs that hold passwords.