JSON to YAML
YAML
JSON
Empty Runs in your browser

YAML to JSON Converter Online - Free & Private

Paste YAML or drop a .yml file and get formatted JSON. Comments are dropped, anchors and aliases are expanded, and a file with several documents becomes a JSON array. If the YAML is invalid, you see the line and column of the problem.

How to convert YAML to JSON

  1. Paste YAML into the left editor, or open or drop a .yaml or .yml file.
  2. Formatted JSON appears on the right. A YAML syntax error is marked in the editor with its line number and a short reason, such as bad indentation.
  3. Browse the result in tree view, copy it, or download it as a .json file.

What happens to YAML features

When to use it

Converting YAML to JSON is useful when an API, a JSON Schema validator or a script expects JSON, when you want to check exactly how a YAML file is parsed (indentation mistakes become obvious in the tree view), or when you need to paste a config into a tool that only accepts JSON.

Example

defaults: &defaults
  retries: 3
api:
  <<: *defaults
  url: https://example.com

becomes {"defaults":{"retries":3},"api":{"retries":3,"url":"https://example.com"}}.

The JSON to YAML converter does the reverse.

Private by design

Your YAML is parsed in your browser with the open-source js-yaml library and is never uploaded.

Frequently asked questions

How do I convert YAML to JSON?

Paste YAML into the left editor or open a .yaml or .yml file. Formatted JSON appears on the right. If the YAML has an error, the line and reason are shown.

What happens to YAML comments?

They are removed, because JSON does not support comments.

Are anchors and aliases supported?

Yes. Anchors, aliases and merge keys are expanded, so the JSON contains full copies of the shared values.

What about files with several documents?

A YAML file with several documents separated by --- becomes a JSON array with one item per document.

Why does my YAML give an indentation error?

YAML uses indentation for structure, and tabs are not allowed for indenting. Make sure child keys line up under each other with spaces. The error message shows the line where the indentation stops making sense.

Editor settings

Type

{
  "id": 1024, "name": "Ada", "active": true,
  "tags": ["0O", "1lI", "=> != >="], "manager": null
}

Colour theme

Code editor

Defaults

Send feedback

How is online-json working for you?