Shard Tools

INI to JSON

Turn an INI configuration file into JSON in your browser.

Maintained by Roshan.

Use INI to JSON

Converts INI text into JSON in this tab. Configuration files routinely hold hostnames, keys and credentials, so nothing here is sent anywhere.

Values are never retyped as numbers or booleansGuessing types is how a converter turns a postcode of 0123 into 123, or a literal string of false into a boolean. Values are carried across as they were written, and casting is left to you where it matters.

Explore developer and data tools

Find related browser-local tools for nearby tasks without starting another search.

Browse all developer and data tools

About INI to JSON

INI is the oldest configuration format still in daily use, and its longevity comes from having almost no rules. A key, an equals sign, a value; square brackets to start a section. That simplicity is also why converting one is less mechanical than it looks, because the format was never standardised and every generation of software added its own conventions. Some writers use a semicolon for comments and others a hash. Some use a colon instead of an equals sign. Quotes may be significant or may be part of the value. This converter handles the conventions that appear in practice and makes one firm decision on your behalf: every value comes out as a string, because INI carries no type information whatsoever and inventing types is how a version number becomes a decimal.

Work through the input

  1. Section headers in square brackets become top-level keys, with the settings inside them nested one level down as an object.
  2. Keys before any section header stay at the root, which is where writers put global settings.
  3. Both the semicolon and the hash are treated as comment markers, and both the equals sign and the colon are accepted as separators, because all four appear in real files.
  4. A value wrapped in a matched pair of quotes has them removed, since quoting in INI exists to protect leading or trailing spaces rather than to be part of the text.
  5. A repeated section header merges into the existing object rather than replacing it, which is how most INI readers behave.

When ini to json is useful

Reading a legacy config into a script

Convert once and work with the JSON. Remember to cast ports and flags yourself, since everything arrives as text.

Comparing two configuration files

Convert both, then use the JSON formatter to sort and compare them. Differences are far easier to spot in normalised JSON than in two INI files with different ordering.

Check the output

Questions about INI to JSON

Why are my numbers strings?

Because INI declares no types. Turning 8080 into a number would be a guess, and the same guess would strip the leading zero from an account code.

Are comments kept?

No. JSON cannot express them. Keep the original file, since comments are often the only documentation a config has.

What about nested sections?

INI does not nest. A section called [a.b] becomes one key with a dot in its name rather than two levels of object.

Which comment character is supported?

Both. Semicolons and hashes are each used by different tools, so both are recognised.

Related tools

JSON to INI

Turn JSON into an INI configuration file in your browser, with objects becoming sections.

ENV to JSON

Turn a .env file into JSON in your browser. Handles export prefixes, quotes and inline comments.

YAML to JSON Converter

Convert YAML to JSON or JSON to YAML in your browser. Handles multi-document files, follows YAML 1.2, and uploads nothing.