How to convert properties to YAML
A .properties file is a flat list of key = value lines. YAML holds the same settings as nested groups. To convert properties to yaml, the tool splits every key at its dots and builds the groups, so server.port=8080 becomes a server group with a port inside it.
Take these five lines:
server.port=8080
feature.beta=yes
feature.build=0123
app.cors.origins[0]=https://example.com
app.cors.origins[1]=https://admin.example.comThe converter writes:
server:
port: 8080
feature:
beta: "yes"
build: "0123"
app:
cors:
origins:
- https://example.com
- https://admin.example.comThree things happened that a plain find-and-replace would get wrong. The port became a number. The two origins became a list. And yes and 0123 were put in quotes. The next sections explain each one.
Convert application.properties to application.yml for Spring Boot
Spring Boot reads settings from application.properties or application.yml, and both formats describe the same keys. To convert application.properties to application.yml, paste the file here and download the result under the name application.yml.
- If both files sit in the same folder, Spring Boot gives the .properties file priority over the .yml file. Delete the old file once you have checked the new one.
- Profile files keep their naming, for example application-dev.properties becomes application-dev.yml. Convert each file on its own.
- A placeholder such as ${DB_HOST:localhost} is plain text to this tool. It is copied as it is and Spring resolves it when the app starts.
Some IDE setups can convert a properties file from the context menu. This page is useful when you do not have the IDE open, when the file came from a ticket or chat, or when you want a list of what was quoted or clashed.
How dotted keys and [0] keys become nested YAML and lists
Each dot starts a new level. Keys with the same start share one group, in the order they first appear. A key ending in [0], [1] and so on becomes a list item, which is the form Spring Boot uses to bind lists. Items such as users[0].name and users[0].role end up in the same list entry.
If the numbers skip, for example [0] and then [2], the items are written in index order with no gap and the Notes panel tells you. A key with an empty part, such as route..empty, cannot be split, so it is kept as one literal key and listed.
Why some values are put in quotes
A properties file stores only text. YAML guesses a type from how a value looks. Older YAML 1.1 parsers, which include the SnakeYAML library behind Spring Boot, read yes, no, on and off as booleans and a number with a leading zero such as 0123 as octal. A value that must stay text is therefore written in quotes.
The Value types option decides the rest. With Detect numbers and booleans, a value is written as a number only when the number prints back exactly as typed, so 8080 becomes a number but 1.50 and 007 stay text. true and false become booleans. With Keep everything as text, every value that could be read as another type is quoted.
The Notes panel lists each quoted value with its line number and the reason, such as would be read as a boolean or null. Check that list before you ship the file.
Key conflicts and repeated keys
A properties file lets you write db=postgres and db.host=localhost. YAML cannot do that, because db would have to be a value and a group at the same time. The tool does not pick one silently.
db: postgres
db.host: localhostWith Key conflicts set to Keep as dotted key, the clashing keys are written at the top level under their full names, as above, and the Notes panel names the lines involved. This works in either order: if the group comes first and the value later, the value is kept and the keys under it become dotted keys. Spring Boot flattens YAML back into dotted names, so db.host still means db.host. If a top-level name is already taken, that line cannot be kept and the notes say it is missing. Set the option to Stop with an error if you would rather fix the source first.
A key that appears twice is not a conflict. Java reads the last value, so the tool does the same and lists the earlier line.
Escapes, continuation lines and comments
The reader follows the Java properties format. Keys and values can be separated by =, : or a space. A line ending in a single backslash continues on the next line, and the leading spaces of that next line are dropped. Escapes such as \n, \t, \\ and \u00e9 are decoded, and so are \u pairs for characters outside the Basic Multilingual Plane. A key can hold an escaped space or equals sign.
path=C:\\Program Files\\App
long.value = first part, \
second part
unicode = \u4e16\u754cpath: C:\Program Files\App
long:
value: first part, second part
unicode: δΈηComment lines that start with # or ! are carried over when Keep comments is on. A comment is placed above the group or key that its line introduces. A comment above a new list item has no place to go in YAML, so it is dropped and counted in the notes.
Options, and what the tool does not do
- Value types: detect numbers and booleans, or keep everything as text.
- Key conflicts: keep the clashing keys as dotted keys, or stop with an error.
- Keep comments: move # and ! comments to the matching YAML key.
- Sort keys: alphabetical order in every group. Lists keep their order.
- Indent: 2 or 4 spaces.
The tool does not resolve ${...} placeholders, does not split a file into profile documents, and does not read Spring maps written with bracket keys such as map[key]. Those keys are kept as text. To use a --- document for a profile, convert the file, then add the separator yourself. For the other direction, use YAML to Properties.
Privacy
Configuration files often hold passwords and tokens. The conversion runs in your browser and the text is not uploaded. See the Privacy Policy for how the site handles data. Even so, replace real secrets with placeholders before you share a file anywhere.
Related converters
Use YAML to Properties to go back, JSON to YAML and YAML to JSON for JSON configs, and JSON to TOML when a project uses TOML.