Properties Special Character Escaping in JSON Conversion

Handle escaped special characters (\=, \:, \#, \!, \\) in .properties files when converting to JSON format.

Syntax Features

Detailed Explanation

Special Character Escaping

In .properties files, certain characters have special meaning and must be escaped with a backslash when used in keys or values:

Character Escape Meaning
= \= Key-value separator
: \: Key-value separator
# \# Comment prefix
! \! Comment prefix
\\ \\\\ Literal backslash
Space \\ Space in key (leading)
\n \\n Newline in value
\t \\t Tab in value

Example with Escaped Characters

# Keys with special characters
url\=pattern=https://example.com?key\=value
path\:windows=C\:\\Users\\admin
equation=2 + 2 \= 4
message.greeting=Hello\nWorld\tWelcome\!

# Key with spaces
my\ key\ with\ spaces=my value

# Value with hash
color.code=\#FF5733
css.selector=.class\#id

JSON Output

{
  "url=pattern": "https://example.com?key=value",
  "path:windows": "C:\\Users\\admin",
  "equation": "2 + 2 = 4",
  "message": {
    "greeting": "Hello\nWorld\tWelcome!"
  },
  "my key with spaces": "my value",
  "color": {
    "code": "#FF5733"
  },
  "css": {
    "selector": ".class#id"
  }
}

Important Notes

  • Escaped separators in keys (\=, \:) prevent the character from being treated as a key-value delimiter
  • Escaped comment characters (\#, \!) in values prevent them from being treated as comment starters
  • Newline (\n) and tab (\t) escapes are converted to their actual characters
  • A double backslash (\\\\) becomes a single backslash in the output

Use Case

Converting properties files that contain Windows file paths, URLs with query parameters, CSS selectors, or regex patterns where special characters are escaped using backslash notation.

Try It — Properties \u2194 JSON Converter

Open full tool