Convert YAML to JSON
This tool converts a YAML file to JSON in your browser, for a Kubernetes manifest, a Docker Compose file or a CI pipeline that a script needs to read as JSON. Types follow the YAML 1.2 core schema: a number, true, false and null keep their type, while on, yes, no and a date such as 2024-01-01 stay strings, the same reading GitHub Actions and most current tooling use. An anchor, an alias and a merge key (<<) are resolved, and every alias is written out as a full copy, because JSON has no references; a file whose aliases would add more than ten million characters, or that refers to itself, is refused. A file with several documents separated by --- gives one JSON file per document, in order, and an empty document, such as one after a trailing ---, is skipped. Comments are not data and are left out. Your file is never uploaded.
Runs in your browser
Drop a file here
YAML, up to 50 MB
How it works
- 1 Choose a YAML file.
- 2 Set the indent between 0 and 8 spaces. 2 is the default, 0 minifies.
- 3 GRID16 parses the document and converts it in your browser.
- 4 Download the JSON.
Questions
- Are numbers and booleans converted?
- Yes, by the YAML 1.2 core schema: a number, true, false and null keep their type. But on, yes, no and a date such as 2024-01-01 stay strings, since that is how GitHub Actions and most current tooling read them.
- What happens to anchors, aliases and merge keys?
- They are resolved, and every alias is written out as a full copy, because JSON has no references. A file whose aliases would add more than ten million characters, or an alias that refers to itself, is refused.
- What happens with a file that holds several documents?
- Each document separated by --- becomes its own JSON file, numbered in order. An empty document, such as one left by a trailing ---, is skipped.
- What about a custom tag such as !Ref or !reference?
- The job is refused. A tag like CloudFormation's !Ref or GitLab's !reference carries meaning that only their own tool can resolve.
- What happens with invalid YAML, or with .inf and .nan?
- A duplicate key, broken indentation or other invalid YAML stops the job with the parser's message, including line and column. .inf, -.inf and .nan are refused too, because JSON cannot hold them.
- Is my file uploaded to a server?
- No. The conversion happens in your browser; the file never leaves your device.