JSON to YAML

Transform JSON data into YAML for config files and dev workflows.

Loading Smart Logic...

Quick Tip

Paste your JSON into the input panel.

About This Tool

Why use JSON to YAML?

Convert JSON to YAML with two-space indentation and no line wrapping, using the js-yaml library. Line wrapping is disabled deliberately: YAML's default is to fold long strings across lines, which is valid but makes URLs, tokens and long commands painful to read and to copy out of a config file.

YAML is what almost all modern configuration is written in — Docker Compose, Kubernetes manifests, GitHub Actions workflows, CI pipelines, OpenAPI specifications. It carries the same data model as JSON with comments and far less punctuation, so converting a JSON snippet into a config file is a routine step rather than a translation exercise.

Key Benefits

No line folding

Long strings such as URLs and commands are kept on one line, so they stay readable and copy cleanly.

Two-space indentation

Matches the convention used by Kubernetes, Docker Compose and GitHub Actions, so the output drops straight into an existing file.

Values quoted where needed

js-yaml quotes anything that would otherwise be misread, which stops strings like yes, no and 1.0 changing type on the way in.

How to use JSON to YAML

  1. 1

    Paste your JSON into the input panel.

  2. 2

    Convert; the structure is re-emitted as YAML with two-space indentation.

  3. 3

    Check the indentation, which is what carries meaning in YAML.

  4. 4

    Copy the YAML into your config file.

Best use cases

Turn a JSON config into a Docker Compose or Kubernetes file.

Write a GitHub Actions workflow from a JSON definition.

Convert an OpenAPI document from JSON to YAML.

Make a dense JSON config readable for a code review.

JSON to YAML FAQs

Are comments added to the YAML?

No. JSON has no comments to carry over, so none appear in the output. You can add them yourself afterwards — that is one of YAML's advantages over JSON.

Why are some values quoted?

Because YAML would otherwise read them as something else. Words like yes, no, on and off are booleans in YAML, and 1.0 is a number, so strings that look like those are quoted to preserve their type.

What indentation is used?

Two spaces, which matches Kubernetes, Docker Compose and GitHub Actions conventions. YAML never allows tabs for indentation.

Is the conversion lossless?

Yes for ordinary data. YAML is a superset of JSON, so every JSON document has an exact YAML equivalent and can be converted back without loss.

Related Data Tools

More free data tools that work well alongside json to yaml.