Java Properties to YAML Converter

Convert Java .properties and Spring Boot application.properties files into clean, hierarchical application.yml configurations.

How to Convert Java Properties to YAML

1

Paste or Upload .properties

Paste your flat dot-notated Java .properties or Spring Boot application.properties content, or drop a properties file.

2

Select YAML Indentation

Choose your desired YAML indentation spacing (2 spaces, 4 spaces, or custom indentation width).

3

Save application.yml

YAML updates reactively in real time. Click Copy or Download to save your application.yml file.

Tool Options

Array & List Indexing

Converts bracket notation (e.g. app.servers[0].host) directly into standard YAML list items (- host: value).

Spring Boot Auto-Type Casting

Preserves booleans (true/false) and numeric ports (8080) while maintaining strings with proper escaping.

100% Client-Side Privacy

Your database credentials, connection strings, and application passwords never leave your browser.

Your Data Privacy

Web Tool
Privacy-First Architecture
Most of our web tools process your data entirely in-browser. Where server processing is technically required, payloads are evaluated statelessly in-memory and are never stored, saved, or logged.
REST API
Stateless In-Memory Processing
When you use our API endpoints, your requests are processed strictly in-memory without persistent database storage, disk logging, or data retention.
Want to learn more about how we safeguard your information and infrastructure?
Read our full Privacy Policy for detailed security standards, data retention principles, and compliance guarantees.

What does the Java Properties to YAML Converter do?

The Java Properties to YAML Converter parses Java .properties files and Spring Boot application.properties configurations and converts them into structured, hierarchical application.yml documents. It transforms dot-delimited property paths and array indices into nested YAML tree mappings while automatically casting numbers, booleans, and multiline continuations.

Core Concepts

Understanding Java properties to YAML conversion mechanics:

  • Dot-Notation Path Hierarchy: Splits dot-delimited property keys (e.g. spring.datasource.url) into indented YAML object blocks.
  • Array & List Indexing: Converts numerical bracket notations (such as app.cors.allowed-origins[0]) into native YAML sequence items (- https://example.com).
  • Primitive Type Casting: Automatically detects numbers (e.g. server.port=8080), booleans (true/false), and unescapes standard Java property escape codes (\n, \t, \:, \=).

How to use the tool?

  1. Paste Properties: Enter or paste your .properties content into the input box or click Sample.
  2. Configure Indentation: Select your desired YAML indentation spacing (2 spaces, 4 spaces, or custom indentation width).
  3. Copy & Export: Converts reactively in real time. Click Copy or Download to save your application.yml file.

Related Developer Utilities

If you work with Java properties, Spring Boot configurations, and YAML formatting, explore these complementary tools:

REST API Integration

blueutils.com provides a free REST API endpoint (POST https://blueutils.com/api/yaml/properties-to-yaml) to programmatically convert Java .properties and Spring Boot application.properties into formatted application.yml files.

API Request Parameters

Name Type Description Example
rawText String / Object Java properties content with dot notation or parsed key-value object (aliases: rawProperties, properties, data, payload, input, text). "spring.datasource.url=jdbc:h2:mem\nserver.port=8080"
indent Number Indentation spaces: 2 (default) or 4 (aliases: spaces, space). 2

API Request Payload Examples

cURL

curl -X POST https://blueutils.com/api/yaml/properties-to-yaml \
  -H "Content-Type: application/json" \
  -d '{
    "rawText": "spring.datasource.url=jdbc:postgresql://localhost:5432/mydb\nserver.port=8080\napp.cors.allowed-origins[0]=https://blueutils.com",
    "indent": 2
  }'

Python

import requests

url = "https://blueutils.com/api/yaml/properties-to-yaml"
payload = {
    "rawText": "spring.datasource.url=jdbc:postgresql://localhost:5432/mydb\nserver.port=8080\napp.cors.allowed-origins[0]=https://blueutils.com",
    "indent": 2
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())

Java

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String jsonPayload = """
            {
                "rawText": "spring.datasource.url=jdbc:postgresql://localhost:5432/mydb\\nserver.port=8080",
                "indent": 2
            }
            """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://blueutils.com/api/yaml/properties-to-yaml"))
            .header("Content-Type", "application/json")
            .POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
            .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}

API Response Parameters

Name Type Description Example
isValid Boolean Indicates whether the conversion succeeded. true
propertyCount Number Count of processed key-value properties. 2
converted String Formatted YAML string. "spring:\n datasource:\n url: ..."

API Response Payload Examples

Success Response (HTTP 200 OK)

{
  "isValid": true,
  "propertyCount": 3,
  "converted": "spring:\n  datasource:\n    url: jdbc:postgresql://localhost:5432/mydb\nserver:\n  port: 8080\napp:\n  cors:\n    allowed-origins:\n      - https://blueutils.com\n"
}

Validation Failure Response (HTTP 400 Bad Request)

{
  "isValid": false,
  "error": "No valid property definitions found."
}

Rate Limit Exceeded Response (HTTP 429 Too Many Requests)

{
  "error": "API rate limit exceeded. Please wait or contact support@blueutils.com."
}

Why use an API to convert properties to YAML?

Integrating the Properties to YAML API into Spring Boot migration scripts or CI/CD modernization tooling provides significant advantages:

  • Rapid Script Validation: Converts legacy flat microservice property files into clean, hierarchical YAML without manual tree editing.
  • Optimized Token Efficiency for AI Agents: LLMs often misalign indentation when restructuring nested property files. Invoking the API parses paths into valid YAML structures deterministically.
  • Deterministic Accuracy Without Hallucinations: Ensures 100% accurate tree nesting, bracket list conversion, and type parsing.

Native Usage

How to convert Java properties to YAML locally in terminal environments or scripts:

Windows (CMD / PowerShell)

# Convert properties to YAML using Python in PowerShell
python -c "
import sys, yaml
data = {}
with open('application.properties') as f:
    for line in f:
        line = line.strip()
        if not line or line.startswith('#'): continue
        k, v = line.split('=', 1)
        parts = k.split('.')
        curr = data
        for p in parts[:-1]: curr = curr.setdefault(p, {})
        curr[parts[-1]] = v
print(yaml.dump(data, default_flow_style=False))
"

Linux / Unix (Bash)

# Convert properties to YAML using Python in Linux
python3 -c "
import sys, yaml
data = {}
for line in open('application.properties'):
    line = line.strip()
    if not line or line.startswith('#'): continue
    k, v = line.split('=', 1)
    parts = k.split('.')
    curr = data
    for p in parts[:-1]: curr = curr.setdefault(p, {})
    curr[parts[-1]] = v
print(yaml.dump(data, default_flow_style=False))
"

Python

Using Python yaml:

import yaml

data = {}
with open('application.properties', 'r') as f:
    for line in f:
        line = line.strip()
        if not line or line.startswith(('#', '!')):
            continue
        key, val = line.split('=', 1) if '=' in line else line.split(':', 1)
        parts = key.strip().split('.')
        curr = data
        for part in parts[:-1]:
            curr = curr.setdefault(part, {})
        curr[parts[-1]] = val.strip()

print(yaml.dump(data, sort_keys=False))

Java

Using Java and SnakeYAML:

import org.yaml.snakeyaml.Yaml;
import java.io.FileInputStream;
import java.util.*;

public class PropertiesToYamlExample {
    public static void main(String[] args) throws Exception {
        Properties props = new Properties();
        try (FileInputStream in = new FileInputStream("application.properties")) {
            props.load(in);
        }
        Map<String, Object> map = new LinkedHashMap<>();
        for (String name : props.stringPropertyNames()) {
            map.put(name, props.getProperty(name));
        }
        Yaml yaml = new Yaml();
        System.out.println(yaml.dump(map));
    }
}

Frequently Asked Questions (FAQ)

How do I convert Spring Boot application.properties to application.yml?

Paste your flat .properties or Spring Boot application.properties content into the input editor, select your preferred indentation spacing (2 or 4 spaces), and click Convert Properties to YAML. The tool converts dot-notated property paths and array indices into clean, hierarchical YAML.

Does it support Spring Boot array and list bracket index notation?

Yes. Array bracket notations like app.servers[0].host and app.servers[1].host are converted directly into standard YAML list items (- host: value).

How are multiline properties and escape sequences handled?

Multiline property lines ending with a backslash continuation character (\) are merged seamlessly into multiline values, and standard escape sequences like \n, \t, \:, and \= are unescaped properly.

Does the converter preserve property value types like booleans and numbers?

Yes. Booleans (true/false) and integer or floating-point numbers (such as server.port=8080) are automatically parsed into native YAML scalar data types, while strings with leading zeros are preserved as strings.

Is my Spring Boot configuration data uploaded to any remote server?

No. All conversion logic runs in-memory with zero server logging, ensuring that database passwords, API credentials, and cloud secrets remain completely private.

Rate Limits

UI Limits
100 uses per 15 minutes
Max payload size: 5 MB
API Limits
5 requests per 60 minutes
Max payload size: 256 KB
Need higher API rate limits, increased payload sizes, or custom developer solutions?
Contact our engineering team at support@blueutils.com for custom rate limit increases, higher quota allocations, or tailored enterprise integrations.