YAML to JSON converter
This YAML to JSON converter reads a YAML document and writes the same data as formatted JSON. It is handy for checking config files, feeding YAML settings into a JSON API or finding indentation mistakes.
- Runs in your browser
- Free, no account needed
- Copy or download the result
Result
Example
# Service settings
name: web
replicas: 3
enabled: true
ports: [80, 443]
owner: null
env:
MODE: production
GREETING: "Hello, world"
steps:
- name: build
run: npm ci
- name: test
run: |
npm test
npm run lint
{ "name": "web", "replicas": 3, "enabled": true, "ports": [ 80, 443 ], "owner": null, "env": { "MODE": "production", "GREETING": "Hello, world" }, "steps": [ { "name": "build", "run": "npm ci" }, { "name": "test", "run": "npm test\nnpm run lint\n" } ] }
How to use the yaml to json converter
- Paste your YAML into the YAML box.
- Press Run.
- If an error appears, fix the line it names and press Run again.
- Use Copy result or Download to save the JSON.
How it works
Supported YAML: block mappings and lists, nested indentation, plain, single-quoted and double-quoted values, literal (|) and folded (>) blocks, comments and one-line flow collections like [1, 2] and {a: b}.
Values follow the YAML 1.2 core schema: true and false, null or ~, integers including 0x and 0o forms, and decimals. Words like yes and on stay text, and 010 is read as 10.
Anchors, aliases, tags, complex keys, directives, multiple documents and tab indentation are rejected with a message naming the feature and the line.
Quoted and plain values must fit on one line, so use | or > for multi-line text. Keys are kept as text, and duplicate keys are rejected.
The JSON is printed with 2-space indentation, and large integers keep all their digits.
Everything runs in your browser. Your input is not uploaded or stored.
Questions and answers
Why does yes stay as text instead of true?
YAML 1.2 only treats true and false as booleans. Older YAML 1.1 tools also read yes, no, on and off as booleans, so quote those words if another tool must agree.
Why is my file rejected for anchors or aliases?
Anchors (&name) and aliases (*name) let YAML reuse a value, but this converter does not expand them. Write the repeated value out in full and run it again.
Can it convert a file with several documents?
No. Split the file at each --- line and convert one document at a time.
What does the tabs error mean?
YAML does not allow tab characters for indentation. Replace the tabs at the start of the named line with spaces.