INI to JSON Converter
Convert INI configuration files to JSON format instantly. Free, secure, and works entirely in your browser.
Drop a file here or click to upload
Supports .ini files
Understanding INI and JSON
INI (Initialization) files are one of the simplest configuration formats in computing. Originating from early versions of Microsoft Windows, the format organizes settings into sections marked with square brackets and stores values as key-value pairs separated by an equals sign. Comments begin with a semicolon (;) or hash mark (#). Despite lacking a formal specification, INI files remain ubiquitous in PHP, MySQL, Git, and countless system utilities.
JSON (JavaScript Object Notation) is a structured, language-independent data format that supports strings, numbers, booleans, null, objects, and arrays. Its strict syntax and rich type system make it the standard for APIs, configuration management, and data interchange between modern applications.
Converting INI to JSON bridges the gap between legacy configuration files and modern tooling. By transforming flat INI data into structured JSON, you gain the ability to programmatically parse, validate, and manipulate configuration with any programming language or framework.
Why Convert INI to JSON?
Converting INI configuration files to JSON unlocks several practical advantages:
- Parsing PHP configs for web tools: PHP applications store runtime settings in
php.ini. Converting to JSON lets web-based admin panels and monitoring tools read and display these settings with full type awareness. - Reading Git configuration programmatically: Git stores user preferences in
.gitconfig, which follows INI syntax. Converting to JSON makes it straightforward to analyze, compare, or sync Git settings across teams using standard JSON tooling. - Processing MySQL configurations: Database administrators often need to compare
my.cnfsettings across environments. Converting to JSON enables diff tools, validation scripts, and automated deployment pipelines to work with the data. - Migrating legacy application settings: Older enterprise systems frequently store configuration in INI files. Converting to JSON is the first step in migrating these settings into modern config management systems like Consul, etcd, or environment variable-based workflows.
- API integration: When you need to expose system configuration through a REST API, JSON is the natural format. Converting INI to JSON lets you serve configuration data to frontend dashboards or microservices.
How the Conversion Works
The converter reads your INI input line by line, identifying sections, key-value pairs, and comments. Each structural element is mapped to its JSON equivalent, and values undergo automatic type detection to produce properly typed JSON output.
| INI Element | JSON Result |
|---|---|
[section] header | Object key with nested object value |
key=value pair | Property inside the section object |
Numeric value (e.g., 3306) | JSON number (3306) |
true / false | JSON boolean |
| String value | JSON string (quoted) |
Comments (; or #) | Stripped (not included in output) |
| Empty value | Empty string ("") |
The automatic type detection is conservative: only values that are clearly numeric (integers and floating-point numbers) or exactly true/false are converted to their JSON types. Everything else is kept as a string to avoid unintended type coercion.
Before and After Example
Below is a typical application configuration file in INI format and the structured JSON output produced by this converter:
INI Input
; Database configuration [database] driver=mysql host=127.0.0.1 port=3306 name=myapp_prod username=app_user password=s3cur3p@ss ; Cache settings [cache] enabled=true driver=redis host=localhost port=6379 ttl=3600
JSON Output
{
"database": {
"driver": "mysql",
"host": "127.0.0.1",
"port": 3306,
"name": "myapp_prod",
"username": "app_user",
"password": "s3cur3p@ss"
},
"cache": {
"enabled": true,
"driver": "redis",
"host": "localhost",
"port": 6379,
"ttl": 3600
}
}Notice how the comments are stripped, numeric values like 3306 and 3600 are converted to JSON numbers, and the boolean true is properly typed rather than kept as a string.
Tips and Best Practices
The converter infers numbers and booleans automatically. Double-check that values like zip codes (01onal) or version strings (3.6) are correctly typed for your use case. You may need to quote them as strings.
INI comments are lost during conversion because JSON has no comment syntax. If your comments contain important context, save them in a separate documentation file or as string properties in your JSON.
INI files often contain passwords and API keys. While this converter processes everything in your browser, be cautious about where you store the resulting JSON file. Avoid committing secrets to version control.
After converting, consider validating the JSON against a JSON Schema to ensure the structure matches what your application expects. This catches type mismatches and missing fields early.
INI files may use mixed conventions (snake_case, camelCase, kebab-case). After converting, consider normalizing key names to match your project's coding standards.
If you plan to convert back to INI later, test the round trip now. Some INI features (comments, key ordering, whitespace) may not survive the conversion, so keep the original INI file as a reference.
Related Tools
Explore other converters and tools for working with INI and JSON data:
How to Convert INI to JSON
- Paste your INI data in the input area, or upload a INI file
- Click the "Convert" button
- View the converted JSON output instantly
- Copy the result or download it as a file
Features
- ✓100% client-side - your data never leaves your browser
- ✓No login or registration required
- ✓Instant conversion with real-time preview
- ✓Supports file upload and drag-and-drop
- ✓Download converted files directly
- ✓Works on mobile and desktop
Frequently Asked Questions
How does INI to JSON conversion work?
The converter parses INI sections (in [brackets]) as JSON object keys, with the key-value pairs within each section becoming nested objects. Values are automatically typed as numbers or booleans when applicable.
What INI format is supported?
Standard INI files with [section] headers and key=value pairs are supported. Comments starting with ; or # are ignored during conversion.
How are data types handled?
The converter automatically detects and converts values: numbers become JSON numbers, 'true'/'false' become booleans, and everything else remains as strings.
Is my data secure?
Yes, all conversion happens directly in your browser. Your data is never sent to any server or stored anywhere.
What happens to INI comments during conversion?
Comments (lines starting with ; or #) are stripped during conversion. JSON does not support comments, so there is no way to preserve them in the output. If you need to keep comments, consider storing them as separate string values in your JSON structure.
Can I convert INI files with duplicate keys?
If your INI file contains duplicate keys within the same section, the last value wins. This matches the behavior of most INI parsers. Consider renaming duplicate keys before conversion if you need to preserve all values.
How are comma-separated values in INI treated?
Comma-separated values remain as plain strings in the JSON output. The converter does not automatically split them into arrays because there is no standard way to distinguish a comma-separated list from a string that naturally contains commas.
Can I convert INI files with subsections?
Yes, subsections using dot notation (e.g., [parent.child]) or other common conventions are parsed into nested JSON objects, preserving the hierarchical structure of your configuration.