go-supertools
Developer & Data Tools

YAML to JSON

Convert YAML to JSON in your browser.

Runs in your browser Your input never leaves your device.

0 characters | 0 words

About this tool

Paste YAML and the JSON equivalent appears as you type, pretty-printed with a 2 space indent. Mappings become objects, sequences become arrays, and scalars keep their types as YAML defines them, so yes and no stay strings while true and false become booleans and numbers stay numbers. The conversion uses the js-yaml library in your browser and nothing is uploaded. Invalid YAML shows a warning with the parser's message and line information. Comments are dropped because JSON has no comments.

How to use it

  1. Paste your YAML into the input box.
  2. Read the JSON in the output.
  3. If a warning appears, fix the indentation or syntax it points to.
  4. Press Copy to use the JSON.

Example

Input
name: web
ports:
  - 80
  - 443
debug: false
Result
{
  "name": "web",
  "ports": [
    80,
    443
  ],
  "debug": false
}

Common problems

A warning about indentation
YAML uses spaces for nesting and does not allow tabs. Align items at the same level with the same number of spaces.
A multi-document file shows a warning
Only a single YAML document is supported. Split files containing several documents separated by --- and convert each on its own.
A value changed type
YAML decides types by format, so an unquoted 0123 or a date may not stay the text you expected. Quote it in the YAML.