Skip to content
LocalOnly

JSON to YAML Converter

Stable

Turn JSON into clean, readable YAML for configs, pipelines and manifests.

Everything is processed locally in your browser

About JSON to YAML Converter

Convert JSON documents into clean, human-readable YAML in one paste. This JSON to YAML converter preserves nesting, arrays and data types while stripping the braces and quotes that make JSON noisy for configuration files. It's ideal for turning API responses or generated JSON into the format Kubernetes, GitHub Actions and Ansible actually expect.

Features

  • Preserves objects, arrays, numbers, booleans and null with correct YAML types
  • Configurable indentation (2 or 4 spaces) to match your project's style
  • Quotes strings only when required, keeping output minimal and readable
  • Handles deeply nested structures without flattening or data loss
  • Emits block-style sequences and mappings that diff cleanly in Git
  • Instant conversion as you type - no upload, no build step, no wait

How to use JSON to YAML Converter

  1. 1

    Paste your JSON

    Drop a JSON object or array into the input panel. Malformed JSON is flagged before conversion so you can fix it first.

  2. 2

    Convert to YAML

    The tool parses your JSON and re-serializes it as YAML instantly, mapping each type to its YAML equivalent.

  3. 3

    Copy or download

    Copy the YAML to your clipboard or download it as a .yaml file, ready to drop into a config or manifest.

Examples

Config object to YAML

A typical project config converted to block-style YAML.

Input

{
  "name": "localonly",
  "version": "2.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build"
  },
  "keywords": ["json", "yaml", "converter"]
}

Output

name: localonly
version: 2.1.0
private: true
scripts:
  dev: next dev
  build: next build
keywords:
  - json
  - yaml
  - converter

How JSON to YAML conversion works

The conversion is lossless because the data models match

YAML is a strict superset of JSON, which makes this direction the easy one. Every JSON construct has a direct YAML equivalent: objects become mappings, arrays become sequences, and the scalar types line up exactly. Nothing has to be approximated or dropped, so the round trip back to JSON returns the same document.

What changes is the syntax and the amount of it. YAML expresses nesting with indentation rather than braces, so the punctuation largely disappears. A three-level JSON object with its braces, brackets, quotes and commas typically becomes noticeably shorter and, for most readers, easier to scan.

That readability is why the ecosystem settled on YAML for anything humans author by hand. Kubernetes manifests, Docker Compose files, GitHub Actions workflows, Ansible playbooks and OpenAPI documents are all YAML, and all of them could equally have been JSON.

Which strings need quotes, and why it is not obvious

In JSON every string is quoted, so the question never comes up. YAML infers types from the shape of a scalar, which means some strings must be quoted to stop them being read as something else - and knowing which is the main subtlety of writing YAML by hand.

The famous case is `"yes"`, `"no"`, `"on"`, `"off"`, `"true"` and `"false"`. Under the YAML 1.1 rules that many parsers still implement, all of these become booleans if unquoted. This is the origin of the so-called Norway problem: the country code `NO` becomes `false`, which has broken real configuration files. YAML 1.2 narrowed the boolean set to just `true` and `false`, but plenty of deployed parsers predate it.

Version strings are the other frequent trap. Unquoted `1.10` is the number 1.1, so a version pin silently changes. And a leading zero can be read as octal, which is how `08` becomes an error and `0755` becomes 493. A converter handles all of this by quoting whatever needs quoting, which is a good reason to convert rather than hand-translate.

YAML features that JSON has no way to express

Comments are the big one, and often the reason for converting in the first place. YAML supports `#` comments, so a converted document can be annotated - which is exactly what configuration files need and exactly what JSON cannot provide.

Anchors and aliases let you define a block once and reference it elsewhere, removing duplication that JSON has to repeat verbatim. Multi-line block scalars, written with `|` or `>`, hold embedded scripts or certificates readably instead of as one long line full of `\n` escapes. Multiple documents can share a file, separated by `---`.

All of these are one-directional gains. Convert back to JSON and comments, anchors and block formatting are gone, because the JSON data model has nowhere to put them. The values survive; the annotation does not.

Reference

Strings that must be quoted in YAML

Left unquoted, each of these is parsed as something other than a string.

ValueUnquoted meaningWrite as
yes / noBoolean under YAML 1.1"yes" / "no"
on / offBoolean under YAML 1.1"on" / "off"
NOfalse - the Norway problem"NO"
1.10The number 1.1"1.10"
0755Octal, i.e. 493"0755"
null / ~The null value"null"
2024-01-15A date in some parsers"2024-01-15"
*starAn alias reference"*star"
: colon-ledA syntax error": colon-led"

Which tool should you use?

These tasks overlap. Here is how to pick the right one for what you are actually doing.

You are writing configuration a human will maintain
YAML, for the comments alone. Undocumented configuration is a recurring operational cost.
You need the data consumed by a browser or an API
Stay with JSON. It parses natively everywhere and has no ambiguity in its type rules.
You are converting the other direction
The YAML to JSON tool handles that, including anchors and multi-document files.
The data is flat and tabular
Neither format is ideal. The JSON to CSV tool produces something a spreadsheet can open.

Use cases

  • Convert an API JSON response into a YAML fixture for tests
  • Author Kubernetes manifests or Helm values from generated JSON
  • Migrate a package.json-style config into a YAML equivalent
  • Produce readable YAML for GitHub Actions or GitLab CI pipelines
  • Turn a JSON settings blob into a commentable YAML config file

Troubleshooting common errors

A string value became a boolean

Why: YAML 1.1 treats `yes`, `no`, `on` and `off` as booleans when unquoted.

Fix: Quote the value. This is worth checking specifically for country codes and any two-letter data.

A version number lost a digit

Why: `1.10` unquoted is the number 1.1, and trailing zeros in floats are not preserved.

Fix: Always quote version strings. Pinned dependency versions are the common casualty.

Indentation errors after editing the converted output

Why: YAML forbids tabs for indentation, and mixing tabs with spaces is a hard error.

Fix: Use spaces only. Configure your editor to expand tabs for `.yaml` and `.yml` files.

A long string was wrapped across lines

Why: Block or folded scalar formatting was applied to keep lines readable.

Fix: Check the marker: `|` preserves newlines, `>` folds them into spaces. The difference matters for embedded scripts and certificates.

Limitations

What this tool deliberately does not do, so you know when to reach for something else.

  • Comments cannot be generated, because the source JSON contains none - you add them afterwards.
  • Anchors and aliases are not inferred from repeated structures.
  • Key order follows the JSON document; YAML mappings are unordered by specification.
  • Very deep nesting produces heavy indentation, where JSON's braces stay compact.
  • Only a single YAML document is produced; multi-document output needs manual assembly.

Frequently asked questions

Learn more

Command Palette

Search for a tool or command