⚡ BreezyTools Pro — Ad-free experience across all 200+ tools. Less than a coffee a month → Learn More

YAML to JSON Converter

Convert YAML to JSON in your browser. No upload, no server.

 

How to convert YAML to JSON

Paste YAML into the input box. The JSON output updates as you type, formatted with two-space indentation, and Copy JSON puts it on your clipboard. The top level can be a mapping (keys and values) or a list. Conversion runs in your browser, so configuration files, keys, and hostnames never leave your device.

Example

# deployment settings
service: api
replicas: 3
debug: false
ports:
  - 8080
  - 8443
owner:
  name: "Dana Lee"
  email: dana@example.com
timeout: 2.5
notes: ~

becomes:

{
  "service": "api",
  "replicas": 3,
  "debug": false,
  "ports": [
    8080,
    8443
  ],
  "owner": {
    "name": "Dana Lee",
    "email": "dana@example.com"
  },
  "timeout": 2.5,
  "notes": null
}

The comment line is dropped, because JSON has no comments. Numbers, true/false, and null (written as ~, null, or an empty value) become JSON types. Everything else becomes a string.

What this converter supports

Parsing is handled by js-yaml, a widely used open-source YAML 1.2 parser, so the converter accepts the full range of everyday YAML:

  • Any consistent indentation: two spaces, four spaces, or mixed between files. Nesting is determined by indentation, as the YAML spec defines it.
  • Block and flow styles: indented mappings and lists, plus inline [a, b] lists and { key: value } mappings.
  • Multi-line strings: literal (|) and folded (>) block scalars, including chomping indicators.
  • Anchors, aliases, and merge keys: &base, *base, and <<: *base are expanded into plain JSON.
  • Multiple documents: a file with several ----separated documents becomes a JSON array with one entry per document.
  • Dates: unquoted timestamps such as 2024-01-05 become ISO 8601 strings, because JSON has no date type.

If the YAML is invalid, the converter shows the parser's error with the line and column number, so you can jump straight to the problem.

YAML vs. JSON

JSON uses braces, brackets, and double-quoted strings, and it has very few ambiguous cases. That makes it the default for APIs and data exchange. YAML uses indentation instead of brackets and allows comments, unquoted strings, and multi-line text, which is why people prefer it for hand-edited configuration files. YAML 1.2 is designed so that almost any JSON document is also valid YAML.

Gotchas when converting YAML

  • The Norway problem. Parsers that follow YAML 1.1, which many still do, read yes, no, on, and off as booleans. So the country code NO turns into false. YAML 1.2 only treats true and false as booleans, and this converter does the same. Still, quote values like these if other tools read the same file.
  • Values that look like numbers. Version 1.10 becomes 1.1, and ZIP code 01234 becomes 1234. Quote anything that's really an identifier.
  • Very large integers. IDs longer than about 15–16 digits lose precision as JSON numbers in JavaScript. Quote them so they stay strings.
  • Colons in list items. This parser reads an unquoted item like - https://example.com as a key-value pair. Write - "https://example.com" instead.
  • Tabs. YAML doesn't allow tabs for indentation, so use spaces only.

Frequently Asked Questions

Does this converter support the full YAML specification?

It supports YAML 1.2 as implemented by js-yaml, which covers block and flow collections, block scalars, anchors and aliases, merge keys, and multi-document files. Custom application tags (for example CloudFormation's !Ref) aren't understood and are reported as errors, since JSON has no equivalent.

What indentation does it expect?

Any consistent number of spaces. Two and four spaces both work, as long as items at the same level line up. Tabs aren't allowed for indentation in YAML, and the converter reports an error with the line number if it finds one.

How are multi-line strings handled?

Literal blocks (|) keep their line breaks, and folded blocks (>) join lines with spaces. Both become ordinary JSON strings, with line breaks written as \n.

Why did yes and no stay as strings?

The converter follows the YAML 1.2 rule that only true and false are booleans. That avoids the Norway problem. If you meant a boolean, write true or false so every YAML parser agrees.

Are comments preserved in the JSON?

No. JSON has no comment syntax, so any YAML-to-JSON conversion drops comments. Keep the YAML file as your source of truth if the comments matter.

Is my YAML uploaded anywhere?

No. Parsing runs in JavaScript in your browser, and nothing is sent to a server. That makes it safe to paste internal configuration files.

Love using BreezyTools?

Go Pro for an ad-free experience, priority features, and support independent development — for less than a coffee a month.

Upgrade to Pro →