Convert · JSON to YAML

Convert JSON to YAML

Turn JSON into clean, block-style YAML for config files, CI pipelines, and Kubernetes manifests. Runs in your browser.

No sign-up to start · Runs in your browser

JSON to YAML
Open your JSON in the editor
JSON
YAML

Runs entirely in your browser — nothing is uploaded.

{"service":"api","port":8080,"features":["auth","cache"],"db":{"host":"localhost","pool":10}}
A JSON-to-YAML converter rewrites a JSON document as YAML, the indentation-based format behind Kubernetes manifests, Docker Compose, and GitHub Actions workflows. JSON Copilot emits block-style YAML with two-space indentation and quotes any value that would otherwise be misread — so a string like "007" or "true" stays a string, not a number or a boolean. Everything runs in your browser: paste JSON, get YAML, nothing uploaded.

JSON to YAML example

JSON input
{
  "service": "api",
  "version": "1.0",
  "port": 8080,
  "debug": "false",
  "zip": "007",
  "replicas": 3,
  "tags": ["auth", "cache"],
  "limits": { "cpu": "500m", "memory": "256Mi" }
}
YAML output
service: api
version: "1.0"
port: 8080
debug: "false"
zip: "007"
replicas: 3
tags:
  - auth
  - cache
limits:
  cpu: 500m
  memory: 256Mi

Objects become mappings and arrays become sequences in two-space block style. version, debug, and zip were strings in the JSON that look like a number, a boolean, and a leading-zero number, so they are quoted to stay strings; port and replicas were real numbers in the JSON, so they stay unquoted. The values 500m and 256Mi need no quotes because they cannot be misread as another type.

How to convert JSON to YAML

  1. 1

    Paste your JSON

    Drop your JSON into the input, or start from the example that is already loaded.

  2. 2

    It converts to YAML

    Objects become mappings, arrays become sequences, and everything is written in two-space block style as you type.

  3. 3

    Check the quoting

    Values that would be read as a number, boolean, or null are wrapped in quotes so they stay strings — look for "007" or "true" staying quoted.

  4. 4

    Copy the YAML

    One click copies the output, ready to paste into a manifest, a Compose file, or a CI workflow.

  5. 5

    Open in the full editor

    Send the source JSON to the editor to format, validate, visualize it as a tree or mind map, and ask the AI copilot about it.

Why use this converter

Runs in your browser

Conversion is 100% client-side — your JSON never leaves your device, and no account is needed.

Type-safe quoting

Strings that look like numbers, booleans, or null (like "007" or "false") are quoted so they round-trip as strings.

Block style, 2-space indent

Mappings sit on their own lines and sequence items are dash-led, indented two spaces per level — the layout config files are written in.

Handles deep nesting

Nested objects and arrays convert to correctly indented mappings and sequences at any depth.

Config-tool ready

Output drops straight into Kubernetes manifests, Docker Compose, GitHub Actions, and Ansible.

Open in the full editor

Take the source JSON into the paid editor to validate, explore, and work on it with the AI copilot.

What YAML is, and why config tools chose it

YAML (a recursive acronym for "YAML Ain't Markup Language") is a data-serialization format that uses indentation instead of brackets and braces to express structure. It is a strict superset of JSON — every JSON document is already valid YAML — but its native block syntax is written to be read and edited by people, which is why it became the default for configuration rather than data interchange.

If you run modern infrastructure you read YAML every day: Kubernetes manifests (Deployment, Service, ConfigMap), Docker Compose files, GitHub Actions and GitLab CI workflows, Ansible playbooks, and Helm values all use it. Teams reach for it because a nested mapping reads like an outline, comments are allowed (JSON has none), and diffs stay tight — changing one setting touches one line, not a cascade of commas and closing braces.

Converting JSON to YAML is common when you already have data from an API response, a database export, or a JSON config and need to drop it into one of those tools. Because YAML is a JSON superset, the conversion is lossless for structure: objects become mappings, arrays become sequences, and scalars carry across unchanged — with quoting added only where a bare value would otherwise be misread.

The quoting rules that keep "true" and "007" as strings

In YAML, an unquoted scalar gets its type inferred from how the text looks. The tokens true, false, yes, no, on, and off become booleans; null and ~ become null; 8080 and 1.0 become numbers. That inference is convenient until your data holds a string that only looks like one of those — a ZIP code of 007, a version string of 1.0, a feature flag stored as the text "false", or a country code. Emit it bare and a YAML parser hands the next tool the wrong type.

This converter guards against that. Any string whose text would parse as a number, boolean, null, or one of YAML's alternate booleans (yes, no, on, off) is wrapped in double quotes so it round-trips as a string. Strings that contain YAML-significant characters — a leading dash, a colon, a hash, brackets, or braces — are quoted too, and an empty string becomes "".

Values that were genuinely numbers or booleans in your JSON stay bare, because their JSON type is unambiguous and needs no protection. The result is YAML that means exactly what your JSON meant: "1.0" stays a string, 8080 stays a number, and nothing silently changes type the moment a parser loads the file.

Block style vs flow style

YAML offers two ways to write a collection. Block style spreads it over indented lines: each mapping key sits on its own line, and each sequence item begins with a dash. Flow style packs the collection onto one line with JSON-like punctuation — [80, 443] for a sequence, {cpu: 500m} for a mapping. Both are valid, and a document can mix them freely.

This tool emits block style with two-space indentation, which is the convention Kubernetes, Compose, and CI runners expect and what most linters enforce. Nested objects indent two more spaces under their key; sequence items sit under the key, each led by a dash. The single exception is empty collections: an empty array is written as [] and an empty object as {} on the same line, because block style has no way to represent "empty".

Block style is the reason YAML is worth using over JSON for config: small line-oriented diffs, room for comments, and structure you can scan top to bottom. Flow style is handy for a short inline list but grows hard to read as nesting deepens, which is exactly where configuration files spend their time — so this converter defaults to block and stays there.

Gotchas to know before you paste it into a config

The classic YAML trap is the "Norway problem": the country code NO parses as the boolean false unless it is quoted, and ON, OFF, and YES behave the same way. This converter quotes those cases for you, but it helps to recognize them when you hand-edit the output later or reason about why a value looks quoted.

Indentation is significant and must be spaces — YAML forbids tabs for indentation, and mixing tabs with spaces is the most common reason a manifest refuses to load. Keeping the two-space steps this tool produces keeps your linter and kubectl apply happy. Remember, too, that comments (lines starting with a hash) do not exist in JSON, so a round trip through JSON and back to YAML drops any comments the original file had.

YAML also has features JSON does not: anchors and aliases for reuse, custom tags, and block scalars (the | and > styles) for multi-line text. A JSON source contains none of these, so the converter never needs to emit them. If you later hand-author them, note that our companion YAML-to-JSON tool reads only the common subset — block mappings and sequences, quoted and plain scalars, flow style, and comments — not anchors, tags, or block scalars, which is worth knowing before you rely on a round trip.

Frequently asked questions

Is the JSON to YAML converter free and private?

Yes. Conversion happens entirely in your browser — no account, no upload, and nothing sent to a server.

Why are some values wrapped in quotes?

A bare YAML scalar has its type inferred from its text, so a string like "007", "1.0", or "false" would be read back as a number or boolean. The converter quotes any string that would otherwise be misread, so it stays a string.

How does it handle nested objects and arrays?

Objects become YAML mappings and arrays become sequences (dash-prefixed items), indented two spaces per level to any depth. Empty arrays and objects are written inline as [] and {}.

What indentation and style does it produce?

Two-space block style: each mapping key on its own line, each sequence item led by a dash, and nested collections indented two more spaces per level. That is the layout config tools and YAML linters expect.

What is the difference between JSON and YAML?

YAML is a superset of JSON that uses indentation instead of braces, allows comments, and infers scalar types from text. Every JSON document is valid YAML, so converting is lossless for structure — it just becomes easier to read and edit as a config file.

Are there YAML features it cannot produce?

It emits plain block-style data, not anchors and aliases, custom tags, or block scalars (| and >). A JSON source has none of those constructs, so nothing is lost in the conversion.

Can I convert the YAML back to JSON?

Yes — use the YAML to JSON tool. It reads the common subset (block mappings and sequences, scalars, flow style, and comments) but not anchors, custom tags, or block scalars.

Where does my result go after converting?

Copy the YAML for your config file, or open the source JSON in the full editor to format, validate, visualize it as a tree or mind map, and work on it with the AI copilot.

Related tools

Convert your JSON to YAML

Open the Editor