YAML and JSON Converter

Paste YAML or JSON and convert it in either direction. Lists, nested maps, quoted text and multi-line blocks are supported, and mistakes are reported by line.

Este contenido está en inglés.

Ejemplos resueltos

YAML list to JSON

name: Asha roles: - admin - editor

{ "name": "Asha", "roles": [ "admin", "editor" ] }

Nested mappings become JSON objects and the dash items become a JSON array.

JSON to YAML

{"city":"Leeds","open":true}

city: Leeds open: true

Numbers, true, false and null keep their types, so true stays a boolean rather than the text.

Sobre YAML and JSON Converter

YAML and JSON describe the same kinds of data, which is why configuration files, API payloads and deployment settings so often need converting from one to the other. YAML relies on indentation and is easy to read, while JSON uses brackets and quotes and is what most programs expect. This converter works in both directions and can detect which one you pasted, so there is no need to choose first, and the result updates as you type. That makes it handy for configuration files and examples in documentation.

The YAML reader understands nested maps and lists, quoted and plain text, numbers, true, false and null, comments, short lists and maps written in square and curly brackets, and multi-line text written with the pipe and greater-than markers. When something is wrong, the message names the line, for example a duplicated key, a tab used for indentation or a bracket that never closes. Going the other way, text that could be mistaken for a number or a boolean is quoted so it survives the trip.

Cómo usar YAML and JSON Converter

  1. Paste YAML or JSON into the input box, or open a file.
  2. Leave the direction on automatic, or choose one yourself.
  3. Pick the indent size and tick Sort keys if you want them in order.
  4. Copy the result, download it, or use it as the next input.

Usos habituales

  • Turning a YAML config into JSON for a tool that only reads JSON
  • Writing an API response out as a readable YAML file
  • Finding the line of an indentation mistake
  • Sorting keys so two files can be compared

Preguntas frecuentes

How do I convert YAML to JSON?

Paste the YAML into the input box. With the direction on automatic, the converter notices it is not JSON and produces formatted JSON on the right. Choose two or four spaces for the indent, then copy the result or download it as a data.json file.

What YAML features are supported?

Nested maps and lists, quoted and plain text, numbers, true, false and null, comments, inline lists and maps, and multi-line text with the pipe and greater-than markers including the minus and plus options. Anchors, aliases, tags, complex keys and files with several documents are not supported.

Why does yes stay as text?

This converter follows YAML 1.2, where only true and false are booleans. Words such as yes, no, on and off are treated as ordinary text, which is also what most modern tools expect. If you need a boolean value, write true or false.

How are mistakes reported?

Each message starts with the line number, for example Line 4 followed by the problem. Typical causes are a tab used for indentation, a key that appears twice, text that is indented further than its neighbours, or a bracket or quotation mark that is never closed.

What happens to very large numbers and dates?

Whole numbers too large to store exactly are kept as text so that no digits are changed. Dates such as 2026-10-15 are also kept as text, because JSON has no date type. When writing YAML, text that looks like a number, date or boolean is put in quotes.

Guías