Properties Multi-line Values to JSON
Convert .properties files with backslash-continuation multi-line values into JSON, handling long SQL queries, URLs, and text blocks.
Detailed Explanation
Multi-line Values in Properties
Java .properties files support multi-line values using a backslash (\) at the end of a line. The backslash, newline, and any leading whitespace on the next line are stripped, and the value continues.
Example: Multi-line Properties
# Long SQL query
db.query.users=SELECT u.id, u.name, u.email, \
u.created_at, u.updated_at \
FROM users u \
WHERE u.is_active = true \
ORDER BY u.created_at DESC
# Long URL with query parameters
api.endpoint=https://api.example.com/v2\
/users\
?include=profile,settings\
&limit=100
# Multi-line description
app.welcome.message=Welcome to our application! \
This tool helps you manage your development \
workflow more efficiently. All processing \
happens in your browser.
JSON Output
{
"db": {
"query": {
"users": "SELECT u.id, u.name, u.email, u.created_at, u.updated_at FROM users u WHERE u.is_active = true ORDER BY u.created_at DESC"
}
},
"api": {
"endpoint": "https://api.example.com/v2/users?include=profile,settings&limit=100"
},
"app": {
"welcome": {
"message": "Welcome to our application! This tool helps you manage your development workflow more efficiently. All processing happens in your browser."
}
}
}
How Continuation Works
- When a line ends with
\, the parser removes the backslash and the newline - Leading whitespace on the next line is stripped (allowing indentation for readability)
- The value continues until a line that does NOT end with
\ - The result is a single continuous string in the JSON output
This is particularly important for SQL queries, long URLs, and descriptive text that would be unreadable on a single line in the properties file.
Use Case
Converting properties files with long SQL queries, URLs, or text blocks that use backslash continuation into JSON for use in configuration management tools or documentation systems.
Try It — Properties \u2194 JSON Converter
Related Topics
Properties Unicode Escape Sequences to JSON
Syntax Features
Properties Special Character Escaping in JSON Conversion
Syntax Features
Convert Spring Boot application.properties to JSON
Spring Boot
Database Connection Properties to JSON
Infrastructure
Preserving Comments When Converting Properties to JSON
Syntax Features