Skip to content

Properties to JSON Converter

Parse Java load(Reader)-style properties into string-valued JSON with continuations, escapes, comments, and duplicate replacement handled explicitly.

Privacy: your files never leave your device. All processing happens locally in your browser.

How to use

  1. 1.Paste character-based Java properties text, including comments and continuations if present.
  2. 2.Convert and compare the unique-key count and escaped values with the source.
  3. 3.Copy the JSON, then validate types and required keys against the consuming application's contract.

About Properties to JSON Converter

Properties to JSON Converter reads the line-oriented format documented for Java java.util.Properties.load(Reader) and produces a pretty JSON object. Paste character text, convert it locally, inspect the number of unique keys, and copy the exact JSON. The page does not upload a file, evaluate placeholders, contact a Java process, or infer scalar types.

Natural lines may end with CRLF, LF, CR, or the end of input. Blank lines are ignored. A line whose first non-whitespace character is # or ! is a comment. An odd run of backslashes before a line ending continues the logical line; the continuation marker, line ending, and leading space, tab, or form-feed characters on the next natural line disappear. An even run does not continue because the backslashes escape each other.

After leading whitespace, the key ends at the first unescaped equals sign, colon, or properties whitespace. Whitespace following that boundary is skipped, and an optional equals or colon after a whitespace separator is also skipped. A line with no separator is a key with an empty value. Escaped separators and spaces remain part of the key or value.

Escape processing recognizes tab, newline, carriage return, form feed, backslash-compatible escaping, and one lowercase-u followed by exactly four hexadecimal digits. As Java documents, a backslash before another character simply removes the backslash; octal and a special backspace escape are not invented. A malformed Unicode escape returns an error instead of being copied as plausible data.

All resulting values remain JSON strings. Spellings such as true, null, 001, 1.5, or 2026-07-20 are not converted to Boolean, null, number, or date. Java Properties is a string key-value model, and automatic type guessing can destroy identifiers, formatting, and application-specific meaning. Convert types later against an authoritative configuration schema.

Duplicate keys use the last value, matching table replacement behavior. The intermediate record has no inherited prototype, so keys such as __proto__, constructor, and toString remain ordinary own data before JSON serialization. Comments and original separator style are not represented in JSON, so this conversion is not a reversible formatter. Keep the source file if order, comments, or exact spelling matters.

This models the character-based Reader method. The browser already supplies Unicode characters; it does not emulate load(InputStream)'s ISO-8859-1 byte decoding. It also does not implement defaults chains, XML properties, environment interpolation, Spring profiles, variable expansion, encrypted secrets, or framework-specific configuration rules. Never paste production secrets into an untrusted destination or share copied output casually.

Limits are 500,000 input characters, 20,000 logical entries, and 2,000,000 output characters. A boundary failure returns no partial JSON. Eight external fixtures cover the three separator forms, escaped spaces, newline and Unicode escapes, continuation, and duplicate replacement. Additional tests cover comments, empty values, prototype-shaped keys, and malformed Unicode. Compare the result with the Java application and validate required keys before replacing configuration.

Methodology & sources

Builds logical lines with odd-backslash continuation, ignores documented comments and blanks, finds the first unescaped key separator, decodes Java Properties escapes including single-u hexadecimal sequences, applies last-key-wins into a null-prototype record, and serializes every value as a JSON string.

Frequently asked questions

Why are true and 123 JSON strings?
Java Properties stores keys and values as strings. Automatic scalar inference could change identifiers and application-specific meanings.
Does this preserve comments and original ordering?
No. JSON represents the final key-value table, not properties formatting history. Keep the source when comments, ordering, or separators matter.
Does this emulate ISO-8859-1 property files?
It models load(Reader) on browser Unicode text. Byte decoding for load(InputStream) is outside scope and should happen before pasting.

Developer Tools guides

View all