Xerobit

Properties to JSON Converter

This tool converts Java .properties text into valid JSON. Paste your key-value pairs on the left and get properly nested JSON on the right. It handles comments, escape sequences and dot-separated keys automatically. Everything runs in your browser so nothing is uploaded to any server.

Paste your .properties content here.

JSON Output

{}

How to use the properties to json converter

  1. Paste your .properties content into the input area.
  2. Set the desired indent size, or use 0 for compact JSON.
  3. The JSON output updates automatically as you type.
  4. Copy the resulting JSON for use in your application.

How properties to json conversion works

The Java properties format stores configuration as flat key-value pairs separated by = or :. Converting properties to json means parsing each line, splitting it at the first unescaped separator, and building a nested object from dot-separated keys.

For example, the input server.port = 8080 becomes the path ["server", "port"] with the string value "8080". The converter walks that path, creating intermediate objects as needed, and assigns the value at the leaf. Lines starting with # or ! are treated as comments and skipped entirely. Blank lines are also ignored during parsing.

Escape sequences handled

Java properties files support several escape sequences that must be decoded before producing JSON output. This converter processes them according to the specification:

EscapeResult
\tTab character
\nNewline
\rCarriage return
\\Backslash
\ Literal space
\=Literal equals sign
\:Literal colon
\uXXXXUnicode code point

When generating the JSON, these decoded characters are re-escaped using standard JSON rules so the output remains valid. For instance, a decoded newline character inside a properties value will appear as \n in the final JSON string.

Common mistakes with dot notation

A frequent error when converting properties to json is mixing scalar values and nested objects under the same key path. If one line defines db = mysql and another defines db.host = localhost, the parser cannot assign both a string and an object to the key db. This tool reports such conflicts clearly instead of silently overwriting data.

Another edge case involves trailing whitespace. In the properties format, leading whitespace around values is stripped unless escaped with a backslash. A line like key = value yields the value value, not value. Multiline values ending with a single backslash also trip people up: the backslash acts as a continuation marker, joining the next physical line after stripping its leading whitespace.

Comparison with similar formats

Properties files share similarities with other configuration formats but have distinct rules. Unlike INI files, properties do not support sections in brackets; nesting is implied purely through dot-separated keys. If you need to convert INI files instead, use the ini to json tool.

TOML also uses dot notation for tables but supports typed values like integers and booleans natively. Properties treat every value as a string. For TOML conversions, see toml to json. Environment files (.env) follow a simpler subset without continuation lines or unicode escapes, which the env to json converter handles. Understanding these differences helps you choose the right tool for your specific configuration format.

Reference table of example conversions

The following table shows how typical properties entries map to their JSON equivalents after conversion:

Properties inputJSON output
name = app{"name": "app"}
a.b = 1{"a": {"b": "1"}}
x:y:z{"x": "y:z"}
k = v1\nv2{"k": "v1\nv2"}

Note that all values remain strings in the JSON output, matching the behaviour of java.util.Properties. Numbers, booleans and nulls are never inferred automatically because the original format does not distinguish between types.

Worked examples

ExampleInputResult
Nested server configProperties input: server.host=localhost / server.port=8080 / app.name=MyApp; Indent spaces: 2{ / "server": { / "host": "localhost", / "port": "8080" / }, / "app": { / "name": "MyApp" / } / }
Escaped charactersProperties input: greeting=Hello\ World / path=C:\\Users\\admin / unicode=caf\u00E9; Indent spaces: 2{ / "greeting": "Hello World", / "path": "C:\\Users\\admin", / "unicode": "café" / }
Colon separatorProperties input: database:url: jdbc:mysql://localhost:3306/db / database:user: admin; Indent spaces: 2{ / "database": "user: admin" / }

FAQ

Does this tool upload my data to a server?

No. The properties to json conversion runs entirely in your browser using JavaScript. Nothing is sent over the network.

Are numeric values converted to JSON numbers?

No. Java properties files store all values as strings, so this converter keeps them as JSON strings to match the original semantics.

Can I use colons instead of equals signs?

Yes. Both = and : are valid separators in the properties format. Whitespace around the separator is ignored.

What happens if a key appears more than once?

Following the Java specification, the last occurrence of a duplicate key wins and its value is used in the JSON output.

Are multiline values supported?

Yes. If a line ends with an odd number of backslashes, the next line is treated as a continuation. The trailing backslash and leading whitespace on the next line are removed.

How does this differ from env to json conversion?

Environment files lack support for unicode escapes, multiline continuations and colon separators. Use the env to json tool for .env files.