Convert YAML to JSON

Convert YAML, such as Kubernetes manifests or CI configs, into JSON. Multi-document files become a JSON array.

Drop your file here, or browse

Images, documents, spreadsheets, data files and subtitles. Your file stays on your device.

Your file is converted on this device and is never uploaded to a server.

When YAML needs to become JSON

YAML is the language of configuration: Kubernetes, Docker Compose, GitHub Actions, OpenAPI specs and countless app settings. It is pleasant to write, but indentation mistakes are easy to make and many tools, validators and APIs only accept JSON.

This converter parses YAML with the yaml library using the YAML 1.2 specification, resolves anchors and aliases, and writes indented JSON. If the file contains several documents separated by ---, you get a JSON array with one element per document.

YAML vs JSON at a glance

Main differences between the YAML and JSON formats
FeatureYAMLJSON
Full nameYAML Ain't Markup LanguageJavaScript Object Notation
TypeHierarchical dataHierarchical data
Introduced2001Early 2000s (RFC 4627 in 2006)
Created byClark Evans, Ingy döt Net and Oren Ben-KikiDouglas Crockford; now ECMA-404 and RFC 8259
StructureMaps and lists nested by indentationNested objects and arrays
CommentsYes, with #No
Data typesStrings, numbers, booleans, null, dates, lists, mapsString, number, boolean, null, object, array
Best forConfig files for Kubernetes, CI pipelines and Docker ComposeAPIs, web apps and app settings
SupportMost languages through librariesEvery programming language
MIME typeapplication/yamlapplication/json

How to convert YAML to JSON

  1. Step 1: Select a .yaml or .yml file

    Drop the config or spec file onto the converter.

  2. Step 2: Keep JSON as the target

    JSON is preselected.

  3. Step 3: Convert

    The YAML is parsed; syntax errors are reported with a message instead of producing broken output.

  4. Step 4: Download the JSON

    Use it with validators, APIs or JavaScript code.

YAML features supported

Multiple documents

Files with --- separators become a JSON array.

Anchors and aliases

&anchor and *alias references are expanded into full values.

YAML 1.2 types

Values like yes, no and on stay strings, avoiding the classic YAML 1.1 surprises.

.yml and .yaml

Both extensions are recognized.

Common YAML to JSON conversions

  • OpenAPI and Swagger. Some tools only import the JSON form of an API spec.

  • Kubernetes debugging. Inspect manifests with JSON tools such as jq.

  • Schema validation. JSON Schema validators usually expect JSON input.

  • App configuration. Load settings in environments without a YAML parser.

What is lost in translation

JSON has no comments, so YAML comments disappear. Anchors and aliases are expanded, which can make the JSON longer when the YAML reused large blocks. Key order is preserved.

Custom tags such as !Ref or !GetAtt, used by AWS CloudFormation, are not standard YAML and may cause warnings or be converted as plain values. Convert CloudFormation templates with AWS tooling when those tags matter.

YAML 1.2 versus 1.1

Older YAML parsers followed YAML 1.1, where yes, no, on and off meant true or false and values like 0755 were octal numbers. This converter follows YAML 1.2, where those words stay strings unless written as true or false. That is safer, but it may differ from what an older tool produced.

Dates written without quotes stay as strings in the JSON, which avoids time zone surprises.

  • country: NO stays "NO" (the Norway problem avoided).
  • enabled: true becomes true.
  • mode: 0755 stays a number in YAML 1.2 as 755.

Tips for YAML to JSON

  • Use spaces, never tabs, for YAML indentation.
  • Quote strings that contain colons followed by spaces.
  • Check multi-document output: it is an array even if you expected one object.
  • Convert back with JSON to YAML after editing, if needed.

YAML to JSON questions

Does it support files with several documents?

Yes. Each document separated by --- becomes one element of a JSON array.

Are comments kept?

No. JSON has no comment syntax, so comments are removed.

Which YAML version is used?

YAML 1.2, the current specification, so yes and no remain strings.

What happens to anchors and aliases?

They are resolved and the referenced values are copied into place.

Why did my conversion fail?

Usually an indentation error or a tab character. The error message points to the problem.

Is the file uploaded?

No. Parsing runs in your browser.

Related conversions