YAML to JSON Converter

Convert YAML to JSON format with validation

YAML Input

JSON Output

Paste your YAML on the left and the JSON shows up here.

Or drop a file on this box, , or .

What is YAML to JSON Converter?

Docker Compose files, Kubernetes manifests and GitHub Actions workflows are all YAML, while the API you post to or the script reading the config usually wants JSON. Paste the YAML here and the JSON appears on the right as you type, indentation turned into braces and brackets. If the result is a list of records, paste it into our home page to view JSON as a table with a filter over each column.

According to MDN Web Docs, both YAML and JSON are popular data formats. YAML is often used in config files (like Docker Compose, Kubernetes, or CI/CD pipelines), while JSON is standard for APIs and web applications. The converter keeps the details that usually go wrong: a 19-digit ID stays the same 19 digits, released: 2024-01-15 stays the string "2024-01-15" instead of turning into a midnight UTC timestamp, and a multi-document file separated by --- becomes a JSON array with one entry per document.

A few things don't survive because JSON has nowhere to put them: comments are dropped, and anchors and aliases (&base, *base, <<: *base) are expanded into full copies. The conversion itself is done by JavaScript on this page; the YAML you paste is never sent anywhere.

How to Use the YAML to JSON Converter

Paste, check, copy. The JSON updates as you type.

1

Paste, Upload, or Load Sample

Type or paste YAML on the left. Upload accepts a .yaml, .yml or .txt file (it is checked as YAML before it replaces what you have). Sample loads two telecom subscribers with a metadata block. A snippet you might paste yourself:

services:
  api:
    image: ghcr.io/maeve/orders-api:1.4.2
    ports:
      - "8080:8080"
    environment:
      DB_HOST: postgres
      ORDER_TIMEOUT_MS: 4500
    depends_on:
      - postgres
2

View JSON Output

The right panel shows the JSON output. Structure is preserved. Invalid YAML shows an error before conversion.

3

Download, Copy, or Minify

Download saves converted.json and Copy puts it on the clipboard; both refuse while the panel shows an "Invalid YAML" message. Minify collapses the output to one line and keeps long integers exact. Clear empties the input and the output with it.

When You'd Actually Use This

Config to API

Convert YAML configs to JSON for use in REST APIs. Great for generating API responses from configuration files or moving configs to JSON-based systems.

Format Preference

Some tools only take JSON: jq, a JSON Schema validator, the AWS CLI --cli-input-json flag. Convert the YAML you maintain by hand and give them JSON instead of keeping two copies in sync.

API Development

kubectl get -o yaml or helm template gives you a multi-document stream. Paste it here and you get a JSON array you can feed to jq or a script, one element per manifest.

Data Migration

Moving settings from a YAML-based tool into one that stores JSON, say from an Ansible vars file into a Terraform .tfvars.json file, starts with a faithful conversion. Paste the old file and check that every nested key landed where you expect.

Common Questions

Is my YAML data stored?

No. It is parsed inside this page and nothing is sent over the network, which matters when the file is a Kubernetes Secret or a CI config full of tokens.

What YAML formats work?

Any valid YAML 1.2 document: mappings, sequences, nested structures, block and folded strings, anchors and merge keys. Files with several documents separated by --- are converted to a JSON array, one element per document. Comments are dropped, since JSON has no comments.

How are nested structures handled?

Nested mappings become nested JSON objects and sequences become arrays. Strings, numbers, booleans and null map straight across. Integers bigger than JavaScript can hold exactly (like an ICCID 8901240544102066246) are written back with every digit, and unquoted dates such as 2024-01-15 come out as the same text in a JSON string.

Can I convert JSON back to YAML?

Yep. Use our JSON to YAML converter to convert JSON files back to YAML format.

What if my YAML has special characters?

Special characters are properly escaped in JSON. Strings with quotes, backslashes, or other JSON syntax characters are handled correctly.

Does it work with large datasets?

A few MB of YAML converts in well under a second on a normal laptop. The whole document is parsed in memory in your browser, so a file of hundreds of MB is better handled with yq -o=json on the command line.

Other YAML Tools You Might Need

Validating, tidying, or turning the same YAML into XML, CSV or TypeScript types happens on these pages: