Properties to JSON — Convert Java Properties Files to JSON
Convert Java .properties files to JSON. Handles dot-notation nesting, Unicode escapes, and multi-line values — in your browser, no upload.
Properties to JSON
Convert Java .properties files to JSON. Supports nested keys (database.host → nested object). Works entirely in your browser.
The Java .properties file is the oldest configuration format still in mainstream use. It predates XML config, YAML, TOML, and JSON — it was introduced in JDK 1.0 in 1995 as part of the java.util.Properties class. Its syntax is simple enough to survive three decades without change: one key-value pair per line, optional comments starting with # or !, backslash for line continuation, and Unicode escapes for non-ASCII characters. The format’s longevity means there are .properties files in production that are older than the developers maintaining them, and converting those files to JSON is the first step in migrating a legacy Java service to a modern stack.
The design decision that defines the conversion is dot-notation nesting. A .properties file with keys like database.host, database.port, and database.name is semantically describing a nested structure — the dots are a convention, not part of the specification. The flat-mode output preserves the keys as-is, which is the safe default and the right choice for simple key-value files. The nesting-mode output infers the hierarchy from the dots and produces a JSON object with the same structure, which is the right choice for configuration migration where the destination format is expected to be structured.
The Unicode escape handling is the other thing that makes manual conversion painful. Java .properties files encode every non-ASCII character as a \uXXXX sequence — the word こんにちは becomes \u3053\u3093\u306b\u3061\u306f. Reading a properties file with Japanese, Arabic, or Cyrillic content in a text editor is effectively impossible without decoding those escapes. The tool decodes all of them during conversion, which turns a file that is unreadable in a text editor into a JSON file that is fully human-readable in any editor or browser.
How to use
Paste a .properties file
Paste the contents of a .properties file into the input. The parser reads key-value pairs, handles line continuations (backslash at end of line), unescapes Unicode escapes (`\uXXXX`), and resolves backslash-escaped characters.
Choose nesting mode
Flat mode keeps keys as-is (`com.example.host` → `{"com.example.host": ...}`). Dot-notation nesting splits on dots to produce nested objects (`com.example.host` → `{"com": {"example": {"host": ...}}}`).
Copy or download the JSON
Copy the JSON to your clipboard or download as a .json file. The output is pretty-printed JSON with sorted keys unless the input order is explicitly preserved.
Frequently asked
How does dot-notation nesting handle overlapping key prefixes?
If a file has both `com.example.host=localhost` and `com.example=value`, the nesting algorithm promotes the value to coexist with nested children: `{"com": {"example": {"_value": "value", "host": "localhost"}}}`. A warning is shown when this collision occurs so you can review the result.
Are comments preserved in the JSON output?
No — .properties comments (lines starting with # or !) are stripped. If you need to preserve metadata alongside values, use the flat mode and add a comments key manually, or switch to YAML which supports comments natively.
How are Unicode escape sequences handled?
Java .properties files encode non-ASCII characters as `\uXXXX` sequences. The tool decodes these to the actual Unicode characters in the JSON output. For example, `message=\u3053\u3093\u306b\u3061\u306f` becomes `"message": "こんにちは"`.
Does it handle Spring Boot application.properties?
Yes — Spring Boot properties files use the same syntax. Profiles (`application-dev.properties`) and placeholder resolution (`${other.key}`) are left as literal strings. For full Spring configuration resolution, use the Spring Boot toolchain; this tool handles the format conversion.
How are boolean and numeric values typed in the JSON output?
By default all values are JSON strings (the safe default — .properties values are always strings). Toggle type inference to convert `true`, `false`, `yes`, `no`, `on`, `off` to booleans and integer/float-looking strings to numbers. The inference follows the Java conventions for property value coercion.
Limitations
- No placeholder resolution`${var}` placeholder references and Spring property expansion are preserved as literal strings. Use a properties processing framework for property resolution.
- No XML properties formatJava also supports an XML-based .properties format (`<!DOCTYPE properties>`). This tool handles the key=value text format only. For XML properties, use the XML to JSON converter.
- Keys with mixed dot-notation depth produce warningsIf the nesting mode is enabled and some keys have 2 parts while sibling keys have 3, the resulting JSON has mixed-depth nesting. The output is valid but the structure may not match expectations.
Platform notes
- macOS
- IntelliJ IDEA and Eclipse both visualise .properties files well. The browser tool is the right pick for converting a properties snippet from a chat or email to JSON for integration with a non-Java tool.
- Linux
- For command-line conversion, `properties-to-json` (npm) does the same. The browser tool adds the dot-notation nesting toggle and the interactive type-inference preview.
- Web
- Runs entirely client-side. Works offline once loaded.