YAML to Java Properties Converter

Convert hierarchical application.yml or YAML files into flat dot-notated Java .properties format.

How to Convert YAML to Java Properties

1

Paste or Upload YAML

Paste your nested application.yml content into the editor, drop a .yaml file, or click Sample.

2

Flatten Tree Hierarchy

Converts dynamically in real time to flatten nested YAML keys and lists into dot-notated paths.

3

Save application.properties

Copy or download the output and save it as application.properties for Spring Boot or Java microservice apps.

Tool Options

Array & List Indexing

Preserves ordered list elements with indexed array keys (e.g. app.servers[0]=alpha).

Escape Handling

Properly escapes multiline values with backslashes according to Java properties standard syntax.

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 YAML to Java Properties Converter do?

The YAML to Java Properties Converter converts hierarchical application.yml and nested YAML documents into flat, dot-notated Java application.properties key-value pairs. It recursively traverses nested maps and indexed YAML lists, converting them into standard Java property keys (such as spring.datasource.url and app.servers[0].host) while escaping newlines and special characters.

Core Concepts

Understanding YAML to Java properties flattening rules:

  • Recursive Tree Flattening: Traverses multi-level nested YAML structures and concatenates keys with dot delimiters (server.port=8080).
  • List Index Formatting: Converts YAML list items into array index notation (e.g. allowed-origins[0]=https://example.com).
  • Character Escaping: Escapes newline breaks and carriage returns (\n, \r) to adhere to standard Java .properties specification rules.

How to use the tool?

  1. Paste YAML Configuration: Enter or paste your application.yml or nested YAML document into the editor or click Sample.
  2. Real-time Live Flattening: Flattens dynamically into dot-notated properties in real time without clicking extra buttons.
  3. Copy & Save: Click Copy or Download to save your flattened application.properties file.

Related Developer Utilities

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

REST API Integration

blueutils.com provides a free REST API endpoint (POST https://blueutils.com/api/yaml/yaml-to-properties) to programmatically flatten nested YAML and application.yml files into standard Java .properties format.

API Request Parameters

Name Type Description Example
rawText String / Object YAML content to flatten into dot notation or parsed JS object (aliases: rawYaml, yaml, data, payload, input, text). "spring:\n datasource:\n url: jdbc:h2:mem"
includeHeader Boolean Whether to prepend comment header metadata (default true). true

API Request Payload Examples

cURL

curl -X POST https://blueutils.com/api/yaml/yaml-to-properties \
  -H "Content-Type: application/json" \
  -d '{
    "rawText": "spring:\n  datasource:\n    url: jdbc:postgresql://localhost:5432/mydb\nserver:\n  port: 8080"
  }'

Python

import requests

url = "https://blueutils.com/api/yaml/yaml-to-properties"
payload = {
    "rawText": "spring:\n  datasource:\n    url: jdbc:postgresql://localhost:5432/mydb\nserver:\n  port: 8080"
}
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:\\n  datasource:\\n    url: jdbc:postgresql://localhost:5432/mydb\\nserver:\\n  port: 8080"
            }
            """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://blueutils.com/api/yaml/yaml-to-properties"))
            .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 conversion succeeded. true
propertyCount Number Count of generated dot-notation property lines. 2
converted String Flattened Java properties file content. "spring.datasource.url=...\nserver.port=8080"

API Response Payload Examples

Success Response (HTTP 200 OK)

{
  "isValid": true,
  "propertyCount": 2,
  "converted": "spring.datasource.url=jdbc:postgresql://localhost:5432/mydb\nserver.port=8080"
}

Validation Failure Response (HTTP 400 Bad Request)

{
  "isValid": false,
  "error": "Invalid YAML syntax: unexpected end of stream"
}

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 YAML to properties?

Integrating the YAML to Properties API into build tools, CI/CD runners, or automated configuration migration scripts offers key advantages:

  • Rapid Script Validation: Converts modern Spring Boot YAML into flat key-value pairs required by legacy Java frameworks and container runtime environment loaders.
  • Optimized Token Efficiency for AI Agents: LLMs often miss keys when manually unnesting large YAML files. Calling the API extracts all property paths deterministically with zero token overhead.
  • Deterministic Accuracy Without Hallucinations: Ensures 100% accurate key flattening and array indexing without property omissions.

Native Usage

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

Windows (CMD / PowerShell)

# Flatten YAML into properties using Python in PowerShell
python -c "
import yaml
def flatten(d, prefix=''):
    for k, v in d.items():
        key = f'{prefix}.{k}' if prefix else k
        if isinstance(v, dict): flatten(v, key)
        else: print(f'{key}={v}')
with open('application.yml') as f:
    flatten(yaml.safe_load(f))
"

Linux / Unix (Bash)

# Flatten YAML into properties using Python in Linux
python3 -c "
import yaml
def flatten(d, prefix=''):
    for k, v in d.items():
        key = f'{prefix}.{k}' if prefix else k
        if isinstance(v, dict): flatten(v, key)
        else: print(f'{key}={v}')
with open('application.yml') as f:
    flatten(yaml.safe_load(f))
"

Python

Using Python yaml:

import yaml

def flatten_dict(d, prefix=''):
    items = []
    for k, v in d.items():
        key = f"{prefix}.{k}" if prefix else k
        if isinstance(v, dict):
            items.extend(flatten_dict(v, key))
        elif isinstance(v, list):
            for i, item in enumerate(v):
                items.extend(flatten_dict(item, f"{key}[{i}]") if isinstance(item, dict) else [f"{key}[{i}]={item}"])
        else:
            items.append(f"{key}={v}")
    return items

with open('application.yml', 'r') as f:
    data = yaml.safe_load(f)
    print("\n".join(flatten_dict(data)))

Java

Using Java and SnakeYAML:

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

public class YamlToPropertiesExample {
    public static void flatten(Map<String, Object> map, String prefix) {
        for (Map.Entry<String, Object> entry : map.entrySet()) {
            String key = prefix.isEmpty() ? entry.getKey() : prefix + "." + entry.getKey();
            if (entry.getValue() instanceof Map) {
                flatten((Map<String, Object>) entry.getValue(), key);
            } else {
                System.out.println(key + "=" + entry.getValue());
            }
        }
    }

    public static void main(String[] args) throws Exception {
        Yaml yaml = new Yaml();
        try (FileInputStream in = new FileInputStream("application.yml")) {
            Map<String, Object> data = yaml.load(in);
            flatten(data, "");
        }
    }
}

Frequently Asked Questions (FAQ)

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

Paste your nested application.yml content into the editor, upload a YAML file, or click Sample, then click Convert YAML to Properties. The tool flattens all nested hierarchy blocks into dot-notated property lines.

How are nested YAML maps and hierarchies flattened into property keys?

Nested dictionary levels are joined recursively with dot notation (e.g. spring.datasource.hikari.maximum-pool-size=10), creating standard flat Java property definitions.

How are YAML lists and sequences converted into properties?

YAML list elements are flattened using standard bracket indexing (such as app.cors.allowed-origins[0]=https://blueutils.com), which is natively supported by Spring Boot configuration binders.

Does the converter handle boolean values, numbers, and multiline strings?

Yes. Primitives like booleans (true/false) and numbers are converted accurately, and multiline strings have newline characters escaped (\n) to conform to standard Java properties specification rules.

Is my YAML configuration or secret data sent to remote servers?

No. Conversion runs in-memory with zero server logging, ensuring that database passwords, API tokens, and deployment secrets remain completely secure and 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.