How to use the json to properties converter
- Paste your JSON object into the JSON input text area.
- The tool automatically parses the JSON and flattens it into dot-notation keys.
- Copy the generated .properties output for use in your project.
How the conversion works
The converter takes a JSON object and recursively walks its structure to produce flat key-value pairs. Nested objects are joined with a dot separator. For example, {"db": {"host": "localhost"}} becomes db.host=localhost.
Arrays use zero-based bracket indices so that order is preserved: {"ports": [80, 443]} produces ports[0]=80 and ports[1]=443. Null values result in an empty string after the equals sign. Booleans and numbers are written as their standard string representations.
Unicode and special character escaping
The Java .properties specification requires certain characters to be escaped. This converter processes every string value to ensure compatibility:
- Characters outside the basic ASCII range (code points above U+007F) are converted to
\uXXXXescape sequences. For instance,ébecomes\u00E9. - Newlines, carriage returns, tabs and backslashes within strings are escaped as
\n,\r,\tand\\. - Leading spaces in values are escaped with a backslash so they are not trimmed when the file is read back.
Keys are also escaped if they contain spaces, colons, equals signs or non-ASCII characters, ensuring the resulting file can be parsed reliably by standard Java utilities.
Common use cases
Converting json to properties is frequently needed when migrating configuration from modern web formats to legacy Java applications. Spring Boot, for example, reads application.properties files where hierarchical settings are expressed with dots.
Developers working across multiple ecosystems often need to translate data between formats. While tools exist to convert json to xml or generate typed classes like a json to java class converter, producing a flat properties file remains essential for environment-specific overrides and simple key-value stores.
If you need tabular representations instead, consider converting json to html table or json to markdown table for documentation purposes.
Reference: JSON types to properties mapping
| JSON Type | Example Input | Properties Output |
|---|---|---|
| String | {"k": "hello"} | k=hello |
| Number | {"k": 42.5} | k=42.5 |
| Boolean | {"k": true} | k=true |
| Null | {"k": null} | k= |
| Nested Object | {"a": {"b": 1}} | a.b=1 |
| Array | {"a": [1, 2]} | a[0]=1a[1]=2 |
| Unicode String | {"k": "ñ"} | k=\u00F1 |
Edge cases and limitations
The root element of the JSON must be an object (enclosed in curly braces). If you provide an array, string, number or boolean at the top level, the converter will return an error because a .properties file fundamentally represents a map of keys to values.
Empty objects ({}) produce no output lines. Keys containing dots in the original JSON are escaped with a backslash so they do not conflict with the dot notation used for nesting. For example, a key literally named a.b at the root becomes a\.b=value.
Very deeply nested structures will produce long dot-separated keys. While technically valid, some older parsers may have limits on line length. The converter itself imposes no arbitrary depth limit beyond what JavaScript's call stack allows.
Worked examples
| Example | Input | Result |
|---|---|---|
| Simple server config | JSON input: {"server":{"host":"localhost","port":8080},"debug":true} | debug=true / server.host=localhost / server.port=8080 |
| Array of users | JSON input: {"users":[{"name":"Alice","role":"admin"},{"name":"Bob","role":"user"}]} | users[0].name=Alice / users[0].role=admin / users[1].name=Bob / users[1].role=user |
| Unicode and null | JSON input: {"greeting":"Héllo Wörld 🌍","missing":null} | greeting=H\u00E9llo W\u00F6rld \uD83C\uDF0D / missing= |
FAQ
What is a .properties file?
A .properties file is a plain text format used primarily in Java applications to store configuration parameters as key-value pairs. Keys and values are separated by an equals sign or a colon.
How are nested JSON objects handled?
Nested objects are flattened using dot notation. A JSON structure like {"database": {"port": 5432}} becomes database.port=5432 in the properties output.
How are JSON arrays converted?
Arrays are converted using zero-indexed bracket notation. An array ["a", "b"] under the key "items" becomes items[0]=a and items[1]=b.
Are unicode characters supported?
Yes. Any character outside the standard ASCII range is automatically escaped into the \uXXXX format required by the Java properties specification.
What happens to null values in JSON?
Null values are converted to empty strings. The key is still written to the output, but nothing appears after the equals sign.
Can I convert a JSON array at the root level?
No. The root element must be a JSON object because a properties file requires named keys. Wrap your array in an object first, such as {"data": [...]}.
Is my data sent to a server?
No. The json to properties conversion runs entirely in your browser using JavaScript. Your data never leaves your device.