YAML Validator and Converter

Check YAML for errors, convert it to JSON, turn JSON or XML into YAML, or move Spring Boot settings between application.properties and application.yml.

Editor (Formatted View)
1
Ready — paste or type JSON / XML / Properties here
Viewer
Converted output will appear here
Ready

What you can do here

ButtonWhat it does
Validate YAMLChecks the YAML and re-indents it, or shows the line and column of the first error
YAML to JSONYAML → JSON. A file with several --- documents becomes a JSON array
Convert to YAMLJSON or XML → YAML
Property to YAMLkey=value lines from a .properties file → nested YAML
YAML to PropertyNested YAML → flat key=value lines

Only need one conversion? The YAML to JSON converter and the JSON to YAML converter do exactly that with one click.

Finding YAML errors

YAML errors are hard to spot because the problem is often whitespace. Paste the file and click Validate YAML: the line with the error turns red and the message says what the parser expected. Common causes:

When the YAML is valid, it is rewritten with consistent two-space indentation. Comments are not kept in the rewritten version, so keep your original if it has comments you need.

Spring Boot: application.properties to application.yml

Spring Boot reads both files the same way. Dotted keys in a properties file turn into nested blocks in YAML:

server.port=8080
spring.datasource.url=jdbc:postgresql://localhost/app
spring.datasource.username=app

becomes

spring:
  datasource:
    username: app
    url: jdbc:postgresql://localhost/app
server:
  port: 8080

The order of keys can change along the way. Spring doesn't care about order, but reorder by hand if you want the file to read top-down. Comments in the properties file are not carried over.

Going the other way, lists become numbered keys: a YAML list under hosts: turns into hosts[0]=… and hosts[1]=…, which is the form Spring expects in a properties file.

Why some keys get quotes

Convert {"country": "no", "y": 2, "on": true} and you'll get:

country: "no"
"y": 2
"on": true

The quotes are deliberate. Older YAML parsers read words like y, n, yes, no, on and off as true or false. Without the quotes, the country code for Norway would turn into false. Quoting keeps them as plain text in every parser.

YAML indentation in short

Frequently asked questions

Is JSON valid YAML?

Yes. YAML 1.2 is a superset of JSON, so any JSON document is also valid YAML. That is also why converting JSON to YAML never loses data. The reverse isn't true: YAML has comments, anchors and multiple documents per file, which JSON can't express.

Should I use application.properties or application.yml?

Both behave the same at runtime. YAML is easier to read when many settings share a prefix. Properties files are easier to override one line at a time and to search with grep.

Does the converter keep comments?

No. JSON has no comments to begin with, and comments in a properties file or a YAML file are dropped when it is converted or re-indented. Add them back by hand if you need them.

Can it convert YAML with several documents?

Yes. When a file has several documents separated by ---, Validate YAML keeps them as separate documents and YAML to JSON turns them into a JSON array with one item per document.

Other tools

Share Content

Choose what to share and generate an instant link

🔥 One-time link Content deleted from server after first view
✉️
Uploading to server…