How YAML maps to JSON
- Mappings become objects, sequences become arrays, and scalars become strings, numbers, booleans or
null. - Values are read with the YAML 1.2 rules used by modern tools:
true/falseare booleans, butyes,no,onandoffstay strings (in YAML 1.1 they were booleans — the cause of the well-known "Norway problem", where the country codeNObecamefalse). Dates such as2024-03-01are kept as strings. - Anchors and aliases are expanded, including merge keys (
<<: *base), so the JSON contains the full values. - A file with several documents separated by
---becomes a JSON array with one element per document. - Comments are dropped, because JSON has no comments.
Common YAML errors
- Tabs for indentation — YAML only allows spaces.
- Inconsistent indentation — every item of a list or mapping must line up.
- A colon inside an unquoted value —
title: Note: read meneeds quotes:title: "Note: read me". - Duplicate keys in the same mapping are rejected rather than silently overwritten.
Is my data uploaded?
No. The conversion runs in your browser, so nothing you add is sent to gratistools.be. See the privacy page for details.