YAML Input

JSON Output

What Is YAML to JSON?

If you've ever had to feed a Kubernetes manifest or a Docker Compose config into a system that only accepts JSON, you know the pain. YAML uses indentation for structure; JSON uses brackets and quotes. They represent the same data model — objects, arrays, strings, numbers, booleans — but the syntax is completely different. The YAML 1.2 spec defines YAML as a superset of JSON, which is why most YAML documents convert cleanly. This tool parses your YAML and outputs formatted JSON per RFC 8259. Everything runs in your browser via JSON.stringify() — nothing is sent to a server, so you can safely paste production configs, secrets, or API responses.

Under the hood the page loads your YAML into a JavaScript object and writes that object back out as JSON. The parsing happens inside this tab with no request going out, which is why a Kubernetes manifest or a production config with credentials in it is fine to paste here.

YAML to JSON Examples

Convert YAML to JSON. Telecom-themed example:

Example: Subscriber record

YAML Input

JSON Output:

JSON Output

Click the Sample button above to load more examples into the editor.

How to Use This Tool

1

Paste or Upload YAML

Drop your YAML into the left editor, or pick a .yaml / .yml file off your disk with Upload. Curious what the output looks like before using your own data? Sample fills the editor with example YAML to experiment on.

2

View the JSON Output

The right panel shows the converted JSON. Use Minify for compact single-line output, or leave it formatted for readability. Invalid YAML will show an error—fix it first using the YAML Validator.

3

Copy or Download

Once the JSON looks right, Copy it for pasting elsewhere or Download a .json file. Going the other direction? Use JSON to YAML. For formatting YAML first, use YAML Formatter.

When YAML to JSON Helps

Kubernetes manifests, Docker Compose files, and GitHub Actions workflows are often written in YAML. If you need to pass that config to a system that expects JSON—an API, a database, or a script—this tool does the conversion. For extracting specific values from large YAML, you can convert to JSON and use jq.

Config files like application.yml (Spring Boot) or .gitlab-ci.yml are YAML. Converting to JSON helps when integrating with tools that only accept JSON, or when you need to validate structure against a JSON schema.

Some APIs and databases store or accept JSON. If your source data is in YAML, converting here gives you the JSON you need. For converting to XML instead, use YAML to XML.

Frequently Asked Questions

Does YAML to JSON preserve comments?

No — JSON has no comment syntax at all. YAML comments start with # and are stripped during conversion. If you need to preserve documentation alongside data, keep it in YAML or move comments to a separate field.

Is it safe to paste API keys or secrets here?

Yes. Conversion runs entirely in your browser — open the Network tab in DevTools while using the tool and you'll see zero requests. No server, no logging, no account required.

What happens to YAML anchors and aliases?

They're resolved during conversion. The output JSON contains the fully expanded structure. YAML anchors like &anchor and aliases like *anchor have no JSON equivalent, so the converter dereferences them inline.

Why does my converted JSON show escaped newlines?

YAML multiline strings (literal blocks with | or folded blocks with >) become JSON strings. In JSON, newlines are represented as \n. If you need the literal content, use the literal block scalar in YAML.

Can I convert back from JSON to YAML?

Yes. Use the JSON to YAML tool. You can also validate the converted JSON with the JSON Validator.

Related Tools

YAML spec. JSON spec. MDN. YAML quick reference. RFC 8259. YAML. Postman.