Convert Basic INI Key-Value Pairs to JSON

Learn how to convert simple INI key=value pairs without sections into a flat JSON object. Covers string, number, and boolean value coercion.

Basic Conversion

Detailed Explanation

From Key-Value Pairs to JSON

The simplest INI file contains key-value pairs at the top level, without any section headers. When converted to JSON, these become properties of a root object.

Example INI

name=MyApplication
version=2.5
debug=true
port=8080
host=localhost

Generated JSON

{
  "name": "MyApplication",
  "version": 2.5,
  "debug": true,
  "port": 8080,
  "host": "localhost"
}

Type Coercion Rules

The converter automatically detects and converts value types:

INI value JSON type Example
Unquoted text String host=localhost"localhost"
Integer Number port=80808080
Decimal Number version=2.52.5
true/false/yes/no/on/off Boolean debug=truetrue
Quoted string String (preserved) name="123""123"

Important Notes

  • Keys are preserved exactly as written --- no case conversion is applied
  • Values with leading or trailing spaces are trimmed unless quoted
  • Empty values (key=) result in an empty string
  • Valueless keys (key without =) can be treated as true or empty string depending on options

Use Case

Converting a simple application configuration file (e.g., a legacy .ini settings file) into JSON for consumption by a modern Node.js or Python application that expects JSON configuration.

Try It — INI \u2194 JSON Converter

Open full tool