YAML to JSON Converter

Convert YAML to JSON with the YAML 1.2 core schema, including multi-document streams separated by ---. Clear error line numbers, runs locally. Free.

Runs entirely in your browser. Your data is never uploaded.

Related Tools

View All

What is YAML to JSON?

Paste YAML – a Kubernetes manifest, a CI config, an OpenAPI file – and get the equivalent JSON. Streams with several documents separated by --- become a JSON array with one element per document.

How to use YAML to JSON

  1. Paste YAML into the YAML input box, or use Load sample or Open file.
  2. Choose the JSON Indentation.
  3. The JSON output updates as you type; use Copy or Download.

Example

Input
name: Ada
langs: [en, fr]
Output
{
  "name": "Ada",
  "langs": [
    "en",
    "fr"
  ]
}

When to use YAML to JSON

Use it to feed YAML into JSON-only tools, debug indentation problems or compare configs. Anchors and aliases are expanded, and comments are lost, because JSON has no equivalent.

How YAML to JSON works

The input is parsed with js-yaml using the YAML 1.2 core schema: true/false, numbers and null/~ get JSON types, while YAML 1.1 quirks such as yes, on or unquoted dates stay strings. All documents in the stream are loaded; one document is output as-is, several as an array. Syntax errors are reported with the line number from the parser.

Common Use Cases

  • Convert a Kubernetes or Docker Compose file to JSON
  • Turn an OpenAPI YAML spec into JSON
  • Debug a GitHub Actions workflow by viewing its parsed structure
  • Split a multi-document YAML stream into a JSON array

FAQs

Why is "yes" not converted to true?

YAML 1.2 (core schema) only treats true/false as booleans. Older YAML 1.1 parsers also accepted yes/no/on/off.

What happens with multiple documents?

Each --- separated document becomes one element of a JSON array, and the number of documents is shown above the output.

Are comments kept?

No – JSON has no comments, so they are dropped.

Good next steps

Explore more categories