Morphy
Home / JSON ⇄ YAML Converter

JSON ⇄ YAML Conversion

Convert JSON and YAML — both common in config files — back and forth in one click.

Choose a mode and paste your data.

Convert between JSON and YAML

YAML is a readability-focused config file format used in many places, such as Docker Compose, Kubernetes, and CI settings. Here you can convert in either direction between JSON, which programs handle easily, and YAML, which people read easily.

What's supported

Anything JSON can represent (objects, arrays, strings, numbers, booleans, null) can be converted in both directions. It handles nesting, flow style ([a, b]·{k: v}), block scalars (|·>), comments, and quoted strings.

Note: anchors/aliases (& *), custom tags, and multiple documents (----separated) are not supported. YAML containing these will raise an error.

JSON vs. YAML: when to use which

Both can represent the same data (objects and arrays), but they differ in look and purpose.

This converter helps when you want to copy an API response (JSON) into a config file (YAML), or turn a YAML config into JSON to inspect it.

Example

This JSON:

{ "name": "morphy", "tags": ["web", "tool"] }

becomes this YAML:

name: morphy
tags:
  - web
  - tool

Things to watch for

Converting YAML to JSON drops comments, because JSON can't hold them. Numbers and booleans are treated as typed values, so if you want to keep something as a string, quote it on the YAML side.

FAQ

Can I convert both ways between JSON and YAML?

Yes. Switch the direction with the tabs at the top to convert either way.

What kind of YAML is supported?

In addition to anything JSON can represent, it supports nesting, flow notation, block scalars, comments, and quoted strings.

Are there any unsupported formats?

Anchors/aliases, custom tags, and multi-document separators are not supported, and will show an error.

What's the main difference between JSON and YAML?

They can represent the same data, but JSON is strict and suited to APIs, while YAML is indentation-based and supports comments, making it great for config files.

Are comments kept when converting?

JSON can't hold comments, so YAML to JSON drops them. JSON to YAML adds none, since the source JSON had none.

Is my data safe?

Yes. Conversion happens only in your browser and nothing is ever sent out.

Related tools