Skip to content

JSON to YAML Converter

Turn JSON into readable block-style YAML, with strings quoted only when necessary.

Processed locally in your browser

Options
0 chars · 0 lines
The result will appear here.

What is JSON to YAML Converter?

YAML is easier to read and edit by hand than JSON, which is why configuration for Kubernetes, Docker Compose, CI systems and OpenAPI is often written in YAML. Converting existing JSON is a common first step.

This converter validates your JSON with a strict parser, then builds a YAML 1.2 document. Strings that would otherwise be read as another type (true, 123, null, empty text, text containing ": ") are quoted automatically, multi-line strings become block scalars, and integers beyond JavaScript’s safe range are written digit for digit. You choose the indentation, the line width and whether keys are sorted alphabetically.

How does it work?

  1. Paste your JSON.
  2. Choose 2 or 4 spaces, the line width (0 for no wrapping) and whether to sort keys.
  3. Read the YAML output; invalid JSON is reported with its line and column.
  4. Copy or download the YAML, or Swap to convert it back to JSON.

Common use cases

  • Converting a JSON API response or settings file into a YAML configuration.
  • Turning an OpenAPI JSON document into YAML for editing.
  • Producing readable Kubernetes or Compose snippets from generated JSON.
  • Checking how a JSON structure looks in block style before committing it.

Examples

Try this input in the tool above:

Input
{"name":"api","version":"1.4.2","ports":[80,443],"env":{"MODE":"prod","DEBUG":"false","RETRIES":3},"notes":"line one\nline two","owner":null,"big":12345678901234567890}
Output
name: api
version: 1.4.2
ports:
  - 80
  - 443
env:
  MODE: prod
  DEBUG: "false"
  RETRIES: 3
notes: |-
  line one
  line two
owner: null
big: 12345678901234567890

Privacy

JSON to YAML Converter runs entirely in your browser. The text or files you provide are processed on your device and are not uploaded, logged or stored on our servers.

Limitations

JSON has no comments or anchors, so none are created. Strings such as yes or no are written unquoted, which YAML 1.1 parsers may read as booleans; quote them manually if your target uses YAML 1.1.

Frequently asked questions

Are strings quoted correctly?

Yes. Values that could be misread as booleans, numbers or null, that are empty, or that contain special sequences are quoted, so converting back gives the same data.

What happens with very large integers?

They are parsed exactly and written digit for digit, so identifiers such as 12345678901234567890 are not rounded.

Can I get a compact YAML?

Set the line width to 0 to avoid folding long strings. Block style itself is always used; for flow style keep the JSON, which is valid YAML.

More tools in JSON & Data →