YAML to JSON.

Convert YAML to JSON instantly in your browser. Fast, free, and designed for developers — no upload, line-aware errors, and full client-side processing.

Processed in your browserNo upload, no signup

YAML input

0 lines · 0 chars

JSON output

0 lines · 0 bytesIndent: 2 spaces

What is YAML?

YAML is a human-friendly data serialization format used for configuration, CI pipelines, and Kubernetes manifests. It uses indentation (no braces or brackets) to express structure and supports maps, sequences, scalars, anchors, and multiline strings.

What is JSON?

JSON is the lingua franca of web APIs. It is strict about quoting strings and has only six value types — object, array, string, number, boolean, and null. Every YAML document can be expressed as JSON, but not the other way around.

YAML vs JSON.

YAML optimises for humans. JSON optimises for machines. YAML allows comments and anchors; JSON does not. YAML is whitespace-sensitive; JSON uses explicit { } and [ ]. When you convert from YAML to JSON, comments are dropped and YAML's flexible scalars (unquoted strings, dates) are emitted as proper JSON types where possible.

How to convert YAML to JSON.

  1. Paste your YAML into the left panel (or load the example).
  2. The converter runs on every keystroke — you should see JSON on the right immediately.
  3. Copy or download the result. To go the other way, click To YAML.

Common YAML conversion errors.

// Mixed indentation

user:
 name: John
  age: 25

YAML requires consistent indentation. The line above mixes two and four spaces, which is a parse error.

// Missing colon

title YAML without a colon

Every key in a mapping needs a : separator. Without one, YAML reads the line as a plain scalar and skips it.

// Tab characters

key:	value

YAML forbids tabs for indentation. Use spaces only. Most editors convert tabs to spaces automatically — but a stray one will break the file.

// Unsupported syntax

This converter supports the core YAML 1.2 spec. Custom tags and esoteric directives are not parsed.

YAML to JSON conversion use cases.

Converting YAML to JSON is a daily task for developers working with APIs, configuration management, and infrastructure-as-code. Many CI/CD platforms accept YAML for workflow definitions but expose their APIs in JSON, so you frequently need to translate between the two. Kubernetes, GitHub Actions, Docker Compose, and Ansible all rely on YAML for configuration, while their REST APIs and SDKs expect JSON payloads.

When building internal tooling, you might store settings in YAML for readability but need JSON when passing those settings to a JavaScript or Python service. This converter handles that transformation instantly. It also preserves type information: YAML numbers stay as JSON numbers, booleans remain booleans, and null values are correctly represented. Strings that look like dates or IPs are emitted as JSON strings rather than being coerced to other types.

Another common scenario is migrating configuration between systems. If you're moving from a tool that uses YAML (like Travis CI) to one that uses JSON (like certain AWS Lambda configurations), this converter lets you transform your existing config without manually retyping every value. The bidirectional mode also works in reverse — paste JSON and get clean, human-readable YAML output.

For developers working with data pipelines, converting between YAML and JSON is essential when integrating services that speak different formats. Log aggregation tools, monitoring systems, and deployment pipelines often require specific input formats. Having a reliable, browser-based converter means you can transform data on the fly without installing dependencies or uploading sensitive configuration to external services.

Your input is processed locally and isn't uploaded for processing. Verify by opening DevTools → Network — there are no requests carrying your data.

YAML to JSON examples.

// Simple object

name: John
age: 25
active: true
{
  "name": "John",
  "age": 25,
  "active": true
}

// Nested object

user:
  name: John
  address:
    city: New York
    country: USA
{
  "user": {
    "name": "John",
    "address": {
      "city": "New York",
      "country": "USA"
    }
  }
}

// Array of items

languages:
  - JavaScript
  - Python
  - Go
{
  "languages": [
    "JavaScript",
    "Python",
    "Go"
  ]
}

Frequently asked questions.

How to convert YAML to JSON?

Paste your YAML into the left panel and the JSON output appears instantly on the right. You can also drag and drop a .yaml or .yml file, or click Upload. The conversion runs entirely in your browser — no server needed.

How to convert JSON to YAML?

Click the "To YAML" button to swap directions. Paste your JSON into the input panel and the YAML output will appear on the right. You can then copy or download the result.

When to use YAML vs JSON?

YAML is best for configuration files, CI/CD pipelines, and human-edited data because it supports comments and is easier to read. JSON is ideal for web APIs, data exchange between systems, and machine-generated data because it is strictly typed and universally supported.

How to convert a YAML file to JSON?

Drag your .yaml or .yml file directly into the input panel, or click the Upload button to select it. The JSON output is generated instantly. You can then copy it to your clipboard or download it as a .json file.

What are the differences between YAML and JSON?

YAML uses indentation for structure and supports comments, anchors, and multiline strings. JSON uses braces and brackets, requires quoted strings, and has no comment syntax. YAML is more human-readable; JSON is more compact and machine-friendly.

How does YAML compare to JSON in terms of readability?

YAML is generally more readable because it uses plain text with indentation instead of brackets and quotes. However, YAML's whitespace sensitivity can cause errors if indentation is inconsistent. JSON is more verbose but unambiguous.

How to convert YAML to JSON in Python?

In Python, use the PyYAML library: import yaml, load your YAML with yaml.safe_load(), then convert with json.dumps(). Example: import json, yaml; data = yaml.safe_load(open("file.yaml")); json.dumps(data). Our online tool does this instantly without any installation.

How to convert YAML to JSON in VS Code?

Install the "YAML to JSON" extension from the VS Code marketplace, or use this online converter by pasting your YAML directly. For command-line conversion, use yq: yq -o=json file.yaml > file.json.

What tools can I use to convert YAML to JSON?

You can use this free online converter for instant browser-based conversion. For CLI tools, try yq, Python with PyYAML, or Node.js with js-yaml. For IDE integration, VS Code and IntelliJ both have YAML to JSON extensions.

Is my YAML data sent to a server?

No. The conversion runs entirely in your browser using JavaScript. Your data never leaves your device — you can verify this by opening the Network tab in DevTools.

Does the converter preserve YAML comments?

JSON has no comment syntax, so comments are dropped during conversion. The structure, types, and ordering of values are preserved.

What happens if my YAML is invalid?

You will see an error message with the exact line and column where the parse failed, plus a hint describing the most likely fix. Your input is preserved so you can correct it.

Related tools.