TanodTools
EN

YAML to JSON converter

Convert YAML 1.2 to JSON locally with anchors and merge keys resolved. Custom tags are rejected; comments are not preserved.

Runs entirely in your browser

Layout

Input up to about 10 MB. It reads YAML 1.2 with the standard types only; custom tags such as !!python/object are refused, not executed.

How to convert YAML to JSON

  1. Paste your YAML into the box, or press Insert a sample.
  2. Choose a JSON layout, or select JSON Lines (.jsonl) for one compact value per YAML document.
  3. Copy the result or download it as .json or .jsonl. Syntax errors show their line and column.

From YAML to JSON

YAML and JSON describe the same kind of data: mappings, lists and simple values. YAML is written by people, with indentation instead of braces, comments, and shortcuts like anchors; JSON is what most programs and APIs expect. Converting between them is common when a Kubernetes manifest, a Compose file or an OpenAPI description has to be fed to something that only reads JSON.

Some YAML features have no JSON equivalent, so the converter resolves them. An anchor (&base) marks a block that an alias (*base) can reuse, and a merge key (<<) copies a mapping's entries into another; in JSON each of those becomes a full copy. Comments are dropped, because JSON cannot hold them. In JSON mode, documents separated by --- become a JSON array. JSON Lines writes one compact value per document, including lists and scalars; an empty document becomes null.

The type rules follow YAML 1.2: true and false are booleans, null and ~ are null, numbers are numbers, and everything else, including yes and 2024-05-01, is text. Syntax errors carry a line and column, and the most frequent causes are a tab used for indentation, a key repeated in the same mapping, and a value that is not indented under its key.

Tips

  • Need to go the other way? JSON to YAML quotes values like "yes" so they survive the trip.
  • Check or tidy the result with the JSON formatter.
  • Got tabular data instead? CSV to JSON covers spreadsheets.

Questions

Why is yes still the text "yes"?

This tool follows YAML 1.2, where only true and false are booleans. The words yes, no, on and off stay strings, which avoids the so-called Norway problem where the country code NO turns into false under YAML 1.1 parsers. If your consumer is a YAML 1.1 parser, it may read those words differently.

What happens to dates and timestamps?

A value such as 2024-05-01 is kept as the string "2024-05-01". JSON has no date type, and converting it to a number or a different format would lose information.

What about very large integers?

Integers beyond 9,007,199,254,740,991 (253 - 1) are written digit for digit rather than rounded, so an ID such as 12345678901234567890 survives. Be aware that a program that later reads the JSON with ordinary JavaScript numbers will round it.

Are anchors, aliases and merge keys supported?

Yes. &name anchors and *name aliases are expanded, and <<: *name merges a mapping into another. Because JSON has no references, each alias is written out in full.