YAML to JSON

Turn a YAML config into plain JSON, with every anchor and alias expanded in place.

or drop them here · files stay on your device
We count formats and sizes. Filenames stay private unless you opt in.

Pretty-print the output
Processed on this device
  • Runs on your device
  • No sign-up or watermark
  • No fixed file size cap

The short answer

To convert YAML to JSON, choose one or more .yaml or .yml files and run the converter. Each file is parsed with js-yaml in your browser, anchors and << merge keys are expanded, and the result is written as JSON. Nothing is uploaded, which matters for configs holding credentials.

How to convert YAML to JSON

  1. STEP 1

    Choose YAML files

    Select one or more .yaml or .yml files. They are parsed on your device and never sent anywhere.

  2. STEP 2

    Set the layout

    Leave Pretty-print the output on for indented JSON, or turn it off for one compact line per file.

  3. STEP 3

    Convert to JSON

    Any syntax error is reported with the file name and the first line of the parser’s message.

  4. STEP 4

    Copy or download

    Copy the JSON from the preview, or download it. Several files come back together as a ZIP.

YAML, JSON and what does not survive the trip

YAML is a superset of JSON designed for people to edit: indentation instead of braces, comments, and anchors (&name) that let you define a block once and reuse it with an alias (*name) or a merge key (<<). Docker Compose, Kubernetes manifests, GitHub Actions and OpenAPI files are commonly written in it.

JSON has no comments and no references, so a conversion has to expand every alias into a full copy and drop the comments. The JSON can therefore be larger than the YAML it came from, and converting it back will not restore the anchors.

What survives, and what does not

Files are parsed with js-yaml’s load function using its default schema, then written with JSON.stringify. Anchors, aliases and merge keys are resolved during parsing. Unquoted dates such as 2024-01-01 are read as timestamps and come out as ISO strings like 2024-01-01T00:00:00.000Z. Each YAML file produces its own JSON file.

What you keep

Nested maps, lists and scalar types: strings, numbers, booleans and null

Anchors, aliases and << merge keys, expanded into full values

Words like yes, no and on stay strings, following YAML 1.2 rather than the older 1.1 rules

What you lose

Comments, which JSON cannot hold

Anchors as references: each alias becomes a duplicated copy

Multi-document files separated by --- are rejected; split them into one document per file first

Unquoted dates are converted to full ISO timestamps

Honest limits are published on every tool page. If a tool cannot do something well, it says so here rather than letting you find out after the download.

YAML to JSON at a glance

InputYAML, YML (one document per file)
OutputJSON
Parserjs-yaml, default schema
Anchors and merge keysExpanded
BatchYes, several files at once
Runs onYour device, in the browser

If something goes wrong

It says expected a single document

The file holds several documents separated by ---, as Kubernetes bundles often do. Split each document into its own file and convert them together.

It reports bad indentation

YAML does not allow tabs for indentation, and nested items must line up. Replace tabs with spaces and check the line named in the message.

YAML to JSON questions

Does converting YAML to JSON keep anchors?

The values are kept, but not as references. Every alias and merge key is expanded into a full copy, because JSON has no way to point at another part of the document.

What happens to YAML comments?

They are dropped. JSON has no comment syntax, so there is nowhere to put them.

Can I convert a Kubernetes or Docker Compose file to JSON?

Yes, as long as each file holds a single document. Multi-document manifests separated by --- need splitting first.

Will yes and no become true and false?

No. The parser follows YAML 1.2, where only true and false are booleans, so yes, no, on and off stay as strings.

Is my config file uploaded?

No. Parsing happens in your browser tab, so environment files with passwords and API keys are not sent to any server.

One of 153 file tools and planned additions. Built and tested by Arin Prajapati, last checked against the code on . canonical: https://damnfiles.com/yaml-to-json
Analytics preferences

Help us understand which tools and file types people use. File contents always stay on your device.

Filename sharing is optional and off by default. Names can contain personal information. Changes apply to future events; disabling sharing does not delete earlier records.

Read our privacy policy