YAML to JSON

Convert YAML to JSON with instant syntax validation.

YAML Input73 chars
JSON Output
JSON output appears here

Related Tools

Documentation

What is YAML to JSON?

YAML to JSON converts a YAML document into an equivalent, syntax-highlighted JSON text output — unlike YAML Parser's inspection-only tree, this produces an actual JSON file you can copy, download, or paste into another tool.

How it works

The input is parsed with js-yaml's load() and the resulting value is serialized with JSON.stringify(data, null, 2). Because YAML is a strict superset of JSON's data model — maps, sequences, and scalars all have direct JSON equivalents — this conversion is lossless for anything js-yaml's default schema supports, though YAML-only features like anchors/aliases are resolved to their expanded values (JSON has no alias concept) and comments are dropped entirely, since JSON has no comment syntax. On a parse failure, the thrown YAMLException's mark gives an exact line and column, shown in the error bar and highlighted in the input gutter; a "dirty" indicator dot appears on the Convert button whenever you've edited the input since the last successful conversion.

Features

  • Full js-yaml default schema support: nested maps/sequences, anchors/aliases, multi-line strings
  • Precise line/column error reporting
  • Dirty-state indicator when input has changed since the last conversion
  • Syntax-highlighted JSON output panel
  • Copy, download as .json, or load a .yaml/.yml file directly

Example

Input:

name: DevFormats
features:
  - format
  - validate
  - minify
free: true

Output:

{
  "name": "DevFormats",
  "features": [
    "format",
    "validate",
    "minify"
  ],
  "free": true
}

Common errors

Mixed tabs and spaces, a missing colon after a key, or an unquoted value YAML interprets as a different type than intended (e.g. a version string like 2.10 parsed as a number, dropping the trailing zero) are the most frequent issues. The first shows up as a YAMLException with a precise line/col; the type-coercion case doesn't error at all — it just produces JSON with a value you didn't expect, so quote ambiguous scalars in the source YAML.

Best practices

Quote scalar values that could be misread as booleans, numbers, or null (version strings, IDs, the literal words yes/no/on/off) before converting, since YAML's implicit typing runs before this tool ever sees the value. To go the other direction, use the JSON to YAML tool.

Frequently Asked Questions

What YAML features are supported?

Anything js-yaml's default schema supports: nested maps and sequences, anchors/aliases, multi-line strings, and the standard scalar types (strings, numbers, booleans, null).

Why does my YAML fail to convert?

The most common causes are mixed tabs/spaces, a missing colon after a key, or an unquoted value that YAML interprets as a different type than intended.

Can I convert the result back to YAML?

Yes — use the JSON to YAML tool for the reverse direction.

Is my data uploaded anywhere?

No — the conversion runs entirely in your browser.