Convert JSON to INI

Drag and drop files here or click to select.
Max file size 100mb.
Uploading progress:

JSON vs INI Format Comparison

Aspect JSON (Source Format) INI (Target Format)
Format Overview
JSON
JavaScript Object Notation

Lightweight data interchange format that is easy for humans to read and write and easy for machines to parse and generate. Based on a subset of JavaScript, JSON has become the universal standard for web APIs, configuration files, and data storage.

Data Format Universal Standard
INI
Initialization File

Simple configuration file format consisting of sections, keys, and values. Originally popularized by Windows for storing application settings, INI files use a flat, human-readable structure with [section] headers and key=value pairs that is easy to edit by hand.

Configuration Simple Format
Technical Specifications
Standard: RFC 8259 / ECMA-404
Encoding: UTF-8 (mandatory)
Format: Text-based with strict syntax
Data Types: String, Number, Boolean, Array, Object, null
Extension: .json
Standard: No formal standard (de facto convention)
Encoding: ASCII / UTF-8
Format: Text-based with [sections] and key=value pairs
Data Types: Strings only (no native types)
Extensions: .ini, .cfg, .conf
Syntax Examples

JSON uses braces and brackets:

{
  "name": "My Project",
  "version": "2.0",
  "features": ["fast", "free"],
  "database": {
    "host": "localhost",
    "port": 5432
  }
}

INI uses sections and key-value pairs:

[general]
name = My Project
version = 2.0
features = fast, free

[database]
host = localhost
port = 5432
Content Support
  • Key-value pairs (objects)
  • Nested objects
  • Arrays (ordered lists)
  • Strings, numbers, booleans, null
  • No comments support
  • No trailing commas
  • Strict syntax rules
  • Sections with [header] syntax
  • Key-value pairs (key=value or key:value)
  • Comments using ; or #
  • No native nesting (single level only)
  • No arrays (values are plain strings)
  • No data types (everything is a string)
  • Whitespace around delimiters is optional
Advantages
  • Universal web standard
  • Native browser support
  • Strict, unambiguous parsing
  • Every programming language has JSON support
  • Ideal for APIs and data exchange
  • Compact representation
  • Extremely simple and human-readable
  • Easy to edit with any text editor
  • Widely used for application configuration
  • Supports inline comments
  • Minimal syntax overhead
  • Native Windows API support (GetPrivateProfileString)
Disadvantages
  • No comments allowed
  • Verbose for deeply nested data
  • No trailing commas
  • Keys must be quoted strings
  • Not human-friendly for large files
  • No formal standard (implementation varies)
  • No support for nested structures
  • No native data types (all values are strings)
  • No array support
  • Limited to flat key-value configuration
Common Uses
  • Web APIs (REST, GraphQL responses)
  • Configuration files (package.json, tsconfig.json)
  • Data storage and exchange
  • NoSQL databases (MongoDB, CouchDB)
  • Browser localStorage
  • Windows application settings (win.ini, system.ini)
  • PHP configuration (php.ini)
  • MySQL configuration (my.ini / my.cnf)
  • Desktop application preferences
  • Game configuration files
  • Git configuration (.gitconfig)
Best For
  • API communication
  • Web application data
  • Configuration management
  • Cross-platform data exchange
  • Simple application configuration
  • User-editable settings files
  • Legacy Windows application support
  • Quick, flat key-value storage
Version History
Introduced: 2001 (Douglas Crockford)
Standard: RFC 8259 (2017), ECMA-404 (2013)
Status: Universal standard
Evolution: JS subset → RFC 4627 → RFC 7159 → RFC 8259
Introduced: 1980s (MS-DOS / early Windows)
Popularized: Windows 3.1 (1992) for system settings
Status: Still widely used, no formal standard
Evolution: MS-DOS config → Windows INI → cross-platform use
Software Support
JavaScript: JSON.parse() / JSON.stringify() (built-in)
Python: json module (built-in)
Databases: MongoDB, PostgreSQL JSONB, MySQL JSON
Other: Every modern language has native JSON support
Python: configparser module (built-in)
PHP: parse_ini_file() / parse_ini_string() (built-in)
Windows: GetPrivateProfileString API (native)
Other: ini4j (Java), go-ini (Go), ini (Node.js npm)

Why Convert JSON to INI?

Converting JSON files to INI format is essential when you need to provide configuration data to applications that expect the traditional INI file structure. Many legacy Windows applications, PHP installations (php.ini), MySQL servers (my.cnf), and desktop software rely on INI files for their settings. If your data originates in JSON from a web service or modern tool, converting it to INI makes it compatible with these systems.

INI files are valued for their simplicity. Non-technical users and system administrators can open an INI file in any text editor and immediately understand its structure. Unlike JSON, which requires matching braces, correct quoting, and no trailing commas, INI files use a straightforward [section] header with key=value lines that are difficult to get wrong. This makes INI the preferred format for user-editable configuration.

Our converter intelligently maps JSON objects to INI sections. Top-level keys that contain nested objects become [section] headers, and their child key-value pairs are placed beneath. Flat top-level values are grouped under a [general] or [default] section. Arrays are serialized as comma-separated values. This produces a clean, well-organized INI file that preserves the intent of the original JSON data.

Key Benefits of Converting JSON to INI:

  • Legacy Compatibility: Provide configuration to Windows apps, PHP, MySQL, and other INI-dependent systems
  • Human Readability: INI is one of the simplest configuration formats to read and edit by hand
  • Comment Support: Unlike JSON, INI files allow inline comments with ; or # for documentation
  • Broad Tool Support: Python configparser, PHP parse_ini_file, and Windows API all parse INI natively
  • Easy Deployment: Drop an INI file into an application directory for instant configuration
  • Minimal Syntax: No braces, brackets, or quoting rules to worry about
  • Structure Preservation: JSON nested objects map cleanly to INI sections and keys

Practical Examples

Example 1: Application Database Configuration

Input JSON file (config.json):

{
  "database": {
    "host": "localhost",
    "port": 3306,
    "name": "myapp_db",
    "user": "admin"
  },
  "cache": {
    "driver": "redis",
    "host": "127.0.0.1",
    "port": 6379
  }
}

Output INI file (config.ini):

[database]
host = localhost
port = 3306
name = myapp_db
user = admin

[cache]
driver = redis
host = 127.0.0.1
port = 6379

Example 2: PHP Application Settings

Input JSON file (settings.json):

{
  "PHP": {
    "engine": "On",
    "memory_limit": "256M",
    "upload_max_filesize": "64M",
    "max_execution_time": 120
  },
  "Session": {
    "save_handler": "files",
    "save_path": "/tmp",
    "gc_maxlifetime": 1440
  }
}

Output INI file (php.ini):

[PHP]
engine = On
memory_limit = 256M
upload_max_filesize = 64M
max_execution_time = 120

[Session]
save_handler = files
save_path = /tmp
gc_maxlifetime = 1440

Example 3: Desktop Application Preferences

Input JSON file (preferences.json):

{
  "window": {
    "width": 1024,
    "height": 768,
    "fullscreen": false
  },
  "editor": {
    "font": "Consolas",
    "font_size": 14,
    "theme": "dark",
    "auto_save": true
  }
}

Output INI file (preferences.ini):

[window]
width = 1024
height = 768
fullscreen = false

[editor]
font = Consolas
font_size = 14
theme = dark
auto_save = true

Frequently Asked Questions (FAQ)

Q: What is JSON format?

A: JSON (JavaScript Object Notation) is a lightweight data interchange format standardized as RFC 8259 and ECMA-404. It uses key-value pairs in objects (curly braces), ordered lists in arrays (square brackets), and supports strings, numbers, booleans, and null. JSON is the dominant format for web APIs, configuration files (package.json, tsconfig.json), and NoSQL databases like MongoDB.

Q: What is INI format?

A: INI (Initialization File) is a simple configuration file format that uses [section] headers and key=value pairs. It originated in early versions of MS-DOS and Windows for storing system and application settings. INI files have no formal standard, but the convention is widely recognized and supported by tools like Python's configparser, PHP's parse_ini_file(), and the Windows API.

Q: How does the JSON to INI conversion handle nested objects?

A: Top-level JSON objects are mapped to INI [section] headers, and their child keys become key=value pairs within that section. Since INI does not support deep nesting, deeply nested JSON objects are flattened using dot notation (e.g., parent.child.key = value) or serialized as a string value, depending on the depth.

Q: What happens to JSON arrays during conversion?

A: JSON arrays are converted to comma-separated values in the INI output. For example, ["fast", "free", "secure"] becomes key = fast, free, secure. This is a common convention since INI has no native array type. If arrays contain objects, each item may be expanded into its own numbered section.

Q: Can I convert the INI file back to JSON?

A: Yes, INI to JSON conversion is straightforward. Each [section] becomes a JSON object key, and key=value pairs become nested properties. However, since INI stores all values as strings, you may need to manually specify which values should be numbers or booleans in the resulting JSON.

Q: Are comments preserved during conversion?

A: JSON does not support comments, so there are no comments to carry over from the source file. However, the generated INI file can include comments (using ; or #) that you can add manually afterward to document configuration options.

Q: What happens if my JSON file has syntax errors?

A: If the JSON file contains syntax errors and cannot be parsed, the converter will treat the content as plain text and include the raw content in the INI file as comments. This ensures you always get output, even if the JSON is malformed. You can then fix the JSON and re-convert.