Convert · YAML to JSON

Convert YAML to JSON

Paste config-style YAML and get clean JSON — mappings, sequences, scalars, and flow style handled, with types detected. Runs in your browser.

No sign-up to start · Runs in your browser

YAML to JSON
Open the JSON in the editor
YAML
JSON

Runs entirely in your browser — nothing is uploaded.

service: api
port: 8080
features:
  - auth
  - cache
db:
  host: localhost
  pool: 10
YAML to JSON turns human-friendly YAML config into JSON that tooling can consume. JSON Copilot parses the common YAML subset — block mappings and sequences, flow style ([] and {}), single and double quotes, comments, and scalar type detection — entirely in your browser, with nothing uploaded. It does not handle anchors, aliases, custom tags, or block scalars (| and >), so paste plain config-style YAML for a faithful result. The converted JSON then opens in the editor for formatting, validation, and visualization.

YAML in, JSON out

YAML config
# deployment config
name: billing-api
port: 8080
replicas: 3
debug: false
tags: [prod, us-east]
resources: {cpu: 500m, memory: 512Mi}
env:
  - LOG_LEVEL=info
  - TZ=UTC
build: "007"
Converted JSON
{
  "name": "billing-api",
  "port": 8080,
  "replicas": 3,
  "debug": false,
  "tags": [
    "prod",
    "us-east"
  ],
  "resources": {
    "cpu": "500m",
    "memory": "512Mi"
  },
  "env": [
    "LOG_LEVEL=info",
    "TZ=UTC"
  ],
  "build": "007"
}

The comment is dropped, port and replicas resolve to numbers, debug to a boolean, the flow collections become an array and an object, and 500m / 512Mi stay strings because they are not pure numbers. build keeps its "007" text because of the leading zero.

How to convert YAML to JSON

  1. 1

    Paste your YAML

    Drop YAML text into the input, or start from the loaded sample config.

  2. 2

    Convert to JSON

    Block mappings become objects, sequences become arrays, and plain scalars are detected as numbers, booleans, null, or strings.

  3. 3

    Check the two panes

    Compare input and output: confirm types resolved as you expect and that IDs like 007 stayed strings.

  4. 4

    Copy or reuse it

    Copy the JSON for a script, an API request body, a jq query, or a test fixture.

  5. 5

    Open the JSON in the editor

    Send the converted JSON into the full editor to format, validate, explore 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 YAML never leaves your device and no account is required.

Block and flow style

Reads indented block collections and inline [] / {} flow collections in the same document, nested freely.

Scalar type detection

Plain numbers, true/false, and null (or ~) become real JSON types; quoted values stay strings.

Comment-aware

# comments are stripped, including mid-line, while a # inside a quoted string is preserved.

ID-safe numbers

Leading-zero values like 007 and runs of more than 15 digits stay strings to avoid precision loss.

Clear about limits

Document markers --- and ... are skipped, and unsupported constructs are documented below so nothing is guessed silently.

What YAML to JSON conversion is

YAML is the format most teams reach for when a config file has to be edited by hand. Kubernetes manifests, CI pipelines, Docker Compose, Ansible playbooks, and application settings all lean on its indentation, comments, and lack of braces. JSON is the format machines prefer: it is stricter, has no comments, and is understood by virtually every language, HTTP API, and query tool. Converting between them lets you keep authoring in YAML while handing a JSON payload to whatever needs it.

Structurally, the mapping is direct. A YAML block mapping — key: value lines at the same indentation — becomes a JSON object. A YAML sequence of - item lines becomes a JSON array. Nesting is expressed by indentation in YAML and by braces and brackets in JSON, so the tree shape is preserved exactly.

The interesting work happens at the leaves. A bare scalar like 8080 has no declared type in the text, so the converter has to decide whether it is a number, a boolean, null, or a string. That coercion step is where most surprises live, and it is spelled out in the next section.

The YAML subset this parser supports

This converter targets the slice of YAML that real config files use. On the collection side it reads block mappings, block sequences, and both flow forms — inline arrays like [prod, edge] and inline objects like {cpu: 500m} — and it lets them nest inside each other. An empty value (a key: with nothing after it and no indented block) becomes null.

Type detection follows predictable rules. true and false in any case become booleans; null and ~ become null. A token made only of digits, optionally signed, becomes a number, and decimals and scientific notation are parsed too. Two guards protect identifiers: a value with a leading zero such as 007 stays a string, and a run of more than fifteen digits stays a string so it does not lose precision as a JavaScript number. Anything you wrap in single or double quotes is kept verbatim, which is how you force "8080" or "true" to stay text.

Comments are handled with quote awareness: a # that begins a comment is stripped, even mid-line, but a # inside a quoted string is left alone. Document markers --- and ... are recognized and skipped rather than treated as data, so a file that opens with --- converts cleanly.

What it does not support — and why that matters

Being honest about limits saves debugging time, so here is what the parser deliberately leaves out. Anchors and aliases (&name to define, *name to reuse) and merge keys (<<) are not resolved: the &b or *b token is read as a literal string rather than expanded, so a manifest that relies on them will convert but produce the wrong shape. Custom and explicit tags such as !!str, !!int, or an application tag like !Ref are not interpreted — the tag text ends up inside the value.

Block scalars are the other gap. The literal (|) and folded (>) styles used for multi-line strings are not assembled. A line like script: | is read as the one-character string "|", and the indented lines beneath it are parsed as if they were structure rather than text.

Because the parser does not raise an error on any of these — it falls back to reading them as plain text — the failure is silent, which is exactly why it is worth calling out. The practical rule is to paste plain, config-style YAML. If your source uses anchors, tags, or block scalars, expand or inline them first (many YAML CLIs can emit a resolved document), then convert. For everything a typical settings or pipeline file contains, the common subset is enough.

Turning config into JSON for tooling

The reason to turn config into JSON is usually a tool on the other side. Scripts and one-off automations read JSON with a single JSON.parse, no YAML dependency required. HTTP APIs expect a JSON request body, so a hand-written YAML payload can be converted and pasted straight into a client. jq, JSONPath, and most query and diff tools operate on JSON, which makes converted config easy to filter, compare across environments, or assert on in tests.

Converted config also makes a clean fixture. Committing the JSON form next to the YAML gives you a stable snapshot to diff when the config changes, and a shape your test suite can load without pulling in a YAML parser.

When you want to do more than copy the result, open it in the full editor. There the converted JSON can be reformatted or minified, validated against a schema, explored as a collapsible tree or a mind map, and questioned with the AI copilot — for example to summarize a large manifest or spot a missing field. The converter answers "what is this YAML as JSON"; the editor is where you work with the answer.

Frequently asked questions

Is the YAML to JSON converter free and private?

Yes. It runs entirely in your browser with no account and no upload — your YAML is never sent to a server.

Which YAML features are supported?

The common config subset: block mappings and sequences, flow style ([] and {}), single and double quotes, comments, and scalar type detection.

What is not supported?

Anchors and aliases (& and *), merge keys (<<), custom tags (!! ...), and block scalars (| and >). These are not parsed — they are read as plain text — so avoid them or expand them first.

How are values typed?

Unquoted 8080 and 3 become numbers, true/false become booleans, null and ~ become null, and anything quoted stays a string. Leading-zero and 16+ digit values also stay strings to protect IDs.

Why did my number stay a string?

Either it was quoted, it had a leading zero (007), or it was long enough (more than 15 digits) to lose precision as a JavaScript number. That is intentional for IDs and version codes.

What is the difference between YAML and JSON?

YAML is a superset of JSON tuned for humans — indentation, comments, no braces — while JSON is stricter and universal for APIs and tooling. This converter narrows YAML down to the JSON machines expect.

Does it convert a multi-document YAML file?

It reads one document. The --- and ... markers are skipped rather than split into an array, so convert one document at a time.

Where does the converted JSON go?

Nowhere until you send it. Copy it from the output, or open it in the full editor to format, validate, and visualize it as a tree or mind map, or run the AI copilot on it.

Related tools

Convert your YAML to JSON

Open the Editor