Convert application.properties with the properties to YAML converter
This properties to YAML converter turns a Java .properties file into YAML by splitting each dotted key into a nested mapping. It is built for the most common case: migrating a Spring Boot project from application.properties to application.yml, where long repeated prefixes like spring.datasource. collapse into one readable block.
Why switch to application.yml?
Spring Boot loads both formats and treats them the same, so the change is about maintainability:
- Shared prefixes are written once, which makes large files easier to scan and review.
- Lists are real YAML sequences instead of
[0],[1]keys. - Several profiles can live in one file, separated by
---withspring.config.activate.on-profile.
The trade-off is that YAML is indentation-sensitive, and a single misplaced space moves a key under the wrong parent. Converting automatically avoids the typos that come from rewriting a hundred keys by hand.
Example
Input:
spring.application.name=orders
spring.datasource.url=jdbc:postgresql://localhost:5432/orders
spring.datasource.username=orders
spring.jpa.show-sql=true
server.port=8081
management.endpoints.web.exposure.include=health,info
spring.profiles.active[0]=dev
spring.profiles.active[1]=metrics
app.version=1.10
app.greeting=Hej, V\u00e4rlden
Output:
spring:
application:
name: orders
datasource:
url: jdbc:postgresql://localhost:5432/orders
username: orders
jpa:
show-sql: true
profiles:
active:
- dev
- metrics
server:
port: 8081
management:
endpoints:
web:
exposure:
include: health,info
app:
version: 1.1
greeting: Hej, Världen
All spring.* keys are grouped under one spring: block even though spring.profiles.active came later in the file. The indexed keys became a YAML list, and the \u00e4 escape was decoded to ä, since YAML files are read as UTF-8.
The typed values option
With Convert numbers & booleans on, 8081 and true are written as native YAML scalars, which Spring binds just as it binds the text versions. Look closely at version-like values, though: app.version=1.10 became 1.1 in the example. If a value must stay exactly as written, turn the option off, and every value is written as a string, with quotes where YAML would otherwise change its meaning (version: '1.10', enabled: 'on').
Edge cases
- A key that is both a value and a parent. Properties allow
logging.level=DEBUGandlogging.level.root=INFOside by side, but YAML cannot givelevela value and children at once. The later line wins, so rename one key before converting. - Numeric segments without brackets, like
servers.0=a, become mapping keys ("0": a) rather than a list. Useservers[0]if you want a sequence. - Comma-separated values such as
health,infostay single strings. Spring splits them when binding to a list, so this is safe. - Placeholders like
${DB_PASSWORD}are copied unchanged; Spring resolves them at runtime in either format. - Comments (
#and!lines) are not carried over. Add them back to the YAML where they still matter. - Continuation lines ending in
\are joined before conversion, so long values arrive as one YAML string.
Related tools
Moving the other way, for example to set properties from a CI system, use YAML to Properties. For JSON output, try Properties to JSON, and check the finished file with the YAML validator.
Privacy
The conversion runs entirely in your browser. Datasource URLs, usernames and passwords in your properties file are never uploaded.