Skip to content

JSON to YAML Converter

Turn JSON into readable YAML with the same keys, order and exact numbers.

Indent
Options
Runs in your browser — your data is not uploaded.

How to use

  1. Click Paste to load JSON from your clipboard.
  2. Set Indent to 2 or 4 spaces per nesting level.
  3. Set Quotes to Auto for quoting only where needed, or Double to quote every string value.
  4. Click Convert if it appears (it shows for very large input, or press Ctrl+Enter); otherwise the YAML updates automatically as you type.
  5. Click Copy to copy the YAML or Download to save a .yaml file.

Examples

Docker Compose service

Input
{"services":{"web":{"image":"nginx:alpine","ports":["8080:80"],"environment":{"APP_ENV":"staging"}}}}
Output
---
services:
    web:
        image: nginx:alpine
        ports:
            - 8080:80
        environment:
            APP_ENV: staging

OpenAPI description with Quotes set to Double

Input
{"openapi":"3.0.3","info":{"title":"Order API","version":"1.0.0","description":"Create and track orders.\nContact: api@example.com"},"paths":{}}
Output
openapi: "3.0.3"
info:
  title: "Order API"
  version: "1.0.0"
  description: "Create and track orders.\nContact: api@example.com"
paths: {}

CI job with a multi-line command and an "on" key

Input
{"name":"Node tests","on":"push","jobs":{"test":{"runs-on":"ubuntu-latest","steps":[{"run":"npm ci\nnpm test"}]}}}
Output
name: Node tests
"on": push
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - run: |-
          npm ci
          npm test

Which strings get quotes

JSON stringYAML outputWhy
"localhost"localhostPlain text is safe without quotes.
"true", "null", "1.10", "0x1F""true", "null", …Without quotes YAML 1.2 would read a boolean, null or number.
"yes", "on", "010", "2026-10-01", "12:30""yes", "on", …YAML 1.1 tools (PyYAML, older Kubernetes tooling) would read a boolean, octal number, date or number.
"a: b", "#x", "- x", " pad""a: b", …Special characters or edge spaces.
"line1\nline2"|- blockMulti-line text keeps its line breaks.

FAQ

Does converting JSON to YAML preserve numbers and key order?

Numbers keep their exact written form, including large integers, decimal zeros and exponent notation. Keys stay in their original order, including number-like keys. If a key is repeated, YAML can't hold both, so only the last value is kept at the position of the first occurrence, with a note. Numbers outside the double range are kept as written, but a note warns that most YAML tools may read them as infinity.

Why are strings like "yes" and "010" quoted?

Quotes stop YAML parsers from reading strings as booleans, numbers or dates. Keep YAML 1.1-safe quoting (in Options) enabled if YAML 1.1 tools such as PyYAML will read the file. Turn it off only for YAML 1.2 tools; strings that YAML 1.2 itself would misread, such as "010" or "true", stay quoted either way.

Can I convert JSON with comments or trailing commas?

The converter accepts strict JSON, so comments, trailing commas and single-quoted strings cause an error. Use JSON5 to JSON first, or click Fix it in JSON Validator → to inspect the input.

Can I convert the YAML back to JSON?

Click Swap after a successful conversion to open the result in YAML to JSON. To check the YAML instead, click Validate YAML.

Is my JSON uploaded or saved?

Conversion runs in your browser, and the tool does not upload your JSON or YAML. The input is not saved; option settings are stored locally, and links to related tools temporarily use sessionStorage to pass the data. Analytics events contain the tool slug, not your JSON or YAML.