YAML to JSON

Paste YAML and convert it to JSON in your browser. Choose tabs or spaces and indent size, including compact output. No signup.

Options
Indent with

Use 0 to minify the JSON.

All conversion happens in your browser. No signup, no upload, no server.

YAML to JSON Converter — Turn YAML Into JSON Online

Convert YAML to JSON Instantly in Your Browser

YAML is human-friendly, but JSON is everywhere. Our free YAML to JSON converter transforms your YAML data into valid JSON in real time, with full control over indentation, spacing, and formatting. Paste your YAML on the left, adjust your output style, and copy clean JSON to your clipboard — all without signing up or uploading anything to a server.

Why Convert YAML to JSON?

YAML shines in config files because it's readable and forgiving — no curly braces, minimal quotes, natural indentation. Kubernetes manifests, Docker Compose files, CI/CD pipelines, and serverless frameworks all favor YAML for their configs. But when you need to feed that data into a JavaScript application, a REST API, a build tool, or a database, JSON is the standard currency.

Converting by hand is error-prone. You have to track parentheses, escape quotes, collapse whitespace, and manage array nesting. A small mistake breaks the whole JSON. This tool handles the parsing and formatting for you, so the output is always syntactically correct.

How to Use the Tool

The widget presents two side-by-side text areas and a set of formatting options underneath.

Step 1 — Paste your YAML. Click the YAML source box and paste your YAML data. Multi-line structures, nested objects, arrays, and lists all work. The tool parses it live as you type, and any syntax error appears in a red box above the JSON output.

Step 2 — Choose your indent style. Two radio buttons let you pick between Spaces (default) and Tabs. Most projects expect spaces, but some teams prefer tabs. Pick whichever matches your workflow.

Step 3 — Set indent size. A number field controls how many spaces or tabs to use per indentation level. The default is 2, which is compact and readable. Use 0 to minify the JSON into a single line, or go up to 8 for deeper nesting where extra spacing helps readability.

Step 4 — Copy the result. Once your JSON appears in the JSON output box on the right, click Copy JSON to send it straight to your clipboard. The button briefly shows Copied so you know it worked. If you want to start fresh, hit Clear source to wipe the input and output.

Everything runs in your browser. There is no signup, no upload, and no server involved — your YAML never leaves the page.

Multi-Document YAML

If your YAML contains multiple documents (separated by ---), the tool automatically wraps them into a JSON array. For example:

Input:

---
name: Alice
age: 30
---
name: Bob
age: 25

Output:

[
  {
    "name": "Alice",
    "age": 30
  },
  {
    "name": "Bob",
    "age": 25
  }
]

Single-document YAML still produces a single JSON object or array, as expected.

Worked Example

Input YAML:

name: Ada
active: true
roles:
  - admin
  - editor
settings:
  theme: dark
  notifications: true

Output JSON (Spaces, indent 2):

{
  "name": "Ada",
  "active": true,
  "roles": [
    "admin",
    "editor"
  ],
  "settings": {
    "theme": "dark",
    "notifications": true
  }
}

Output JSON (Tabs, indent 1 — minified-like appearance):

{
	"name": "Ada",
	"active": true,
	"roles": [
		"admin",
		"editor"
	],
	"settings": {
		"theme": "dark",
		"notifications": true
	}
}

Output JSON (indent 0 — fully minified):

{"name":"Ada","active":true,"roles":["admin","editor"],"settings":{"theme":"dark","notifications":true}}

FAQ

Does this tool upload my YAML anywhere? No. All conversion happens locally in your browser using JavaScript. Your YAML never touches a server, and there is no logging or analytics tied to your input.

What if my YAML is invalid? The tool displays an error message and leaves the JSON output empty. Check your indentation, quoted strings, and bracket pairing. YAML is whitespace-sensitive, so even a misaligned space can break parsing.

Can I convert JSON back to YAML? This tool only converts YAML to JSON. If you need the reverse, look for a dedicated JSON to YAML converter.

What indent size should I use? That depends on your project's style guide. Most web projects use 2 spaces for readability without bloat. Some use 4 spaces or tabs. Use 0 if you are embedding JSON in a URL or minimizing file size.

Does it handle all YAML features? The tool supports core YAML — scalars, lists, maps, nested structures, and multi-document files. Advanced features like custom tags or anchors/aliases may have edge cases, but common YAML config files work perfectly.

Is there a file size limit? The browser's memory is the limit. For typical config files (tens or hundreds of KB), you will have no trouble. Massive YAML files may slow down parsing slightly, but the tool is designed to handle realistic workloads.

Related Tools

  • SVG to CSS — Encode SVG images as data URIs and CSS backgrounds
  • Text to Slug — Turn headlines into clean URL slugs