b2KIT

YAML to JSON Converter

Convert between YAML and JSON formats with validation, formatting, and error highlighting.

Tested tool guide Tested browser tools Checked August 16, 2026

What YAML to JSON Converter does, with a checked example

Drop a YAML document into this tool and it re-emits the same data as JSON, resolving every unquoted scalar to a concrete type: `true` becomes a boolean, `42` a number, everything else a string. It formats the output, highlights syntax errors with line and column, and converts in the reverse direction when you paste JSON. The conversion runs entirely in the browser; nothing is uploaded. The first thing people trip on is that YAML guesses types: values you think of as text, such as `yes`, `on`, or `0123`, can come out as booleans or numbers unless they were quoted. The output shows exactly what a parser would hand your code.

Worked example

A concrete input and expected output from the current implementation.

Input

name: Apollo
enabled: true
count: 42
tags:
  - yaml
  - json
notes: |
  line one
  line two

Expected output

{
  "name": "Apollo",
  "enabled": true,
  "count": 42,
  "tags": [
    "yaml",
    "json"
  ],
  "notes": "line one\nline two\n"
}

YAML resolves unquoted `true` and `42` into JSON's boolean and number types, and the indented list under `tags` becomes an array of strings. The literal block after `|` becomes a string that keeps its line breaks, including the final one (default clip chomping), so JSON escapes it as `\n`.

How the result is produced

1

Parsing and type resolution

The document is parsed by indentation: nested blocks become nested objects and arrays, and each unquoted scalar is resolved by pattern into a JSON type. Booleans, integers, floats, and null are detected; everything else, including version-like strings such as 1.2.0, stays a string. Quoting forces a string. Parse errors such as tabs inside indentation or an undefined alias are reported with line and column and highlighted in the input pane.

2

Serialization and formatting

The resolved tree is serialized as JSON with your chosen indentation: strings are quoted with escaping, while booleans, numbers, and null appear unquoted. Keys become strings because JSON requires it. Block scalars arrive as strings that keep their internal line breaks, including the trailing newline, shown escaped as \n. Multi-document streams and anchors have no JSON equivalent and need special handling, so verify unusual input against the source.

Good uses

  • Handing a YAML configuration (docker-compose, CI pipeline, Helm values) to a script or service that only accepts JSON, with the conversion checked rather than eyeballed.
  • Debugging a config mystery: paste the YAML and read what each unquoted scalar resolves to, so `on`, `yes`, or `0123` cannot silently change meaning in the code that consumes it.
  • Making JSON readable: convert to YAML for editing with comments and cleaner layout, then convert back when the file must be JSON again.

Limits and checks

  • Resolution is flavor-dependent: under YAML 1.1 rules `yes`, `no`, `on`, and `off` are booleans and `0123` is octal (83); under YAML 1.2 rules they remain strings. The output tells you which rules the parser follows. Quote any scalar that must stay text.
  • The conversion is lossy: comments, anchors, aliases, custom tags, and multi-document streams have no JSON representation, so converting back will not reproduce your YAML. Use it to translate or inspect, not to round-trip a file you need to preserve.
  • Indentation is structure. A tab where spaces belong is an error, and one misindented line can silently re-nest an entire subtree. The error position marks where the parser lost confidence, which can be far from the line you actually broke, so verify the output rather than assuming the structure survived.

Common questions

Why does `on` come out as `true`?

Under YAML 1.1-style resolution, `on`, `off`, `yes`, and `no` are booleans, so `on` becomes true; under strict YAML 1.2 rules it would stay the string "on". Quote the value, `"on"`, to force a string. The same applies to `0123`, which is octal (83) under 1.1 rules and a plain string under 1.2.

Can I convert my YAML to JSON and back and get the original file?

No. JSON to YAML is essentially lossless because every JSON document is valid YAML, but the reverse direction drops comments, anchors, aliases, and tags, and unquoted scalars can resolve differently on the way back. Use this tool to translate data or inspect what a parser sees, not to edit and restore the same file.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools