TodayTools

YAML to JSON

Switch a settings file between YAML and JSON in a click, with nothing lost.

PrivateNo uploadsRuns in your browser

Donate

Indent is the space before each line. Sort keys puts names in A to Z order.

A man in a checked shirt working on a laptop

For the settings file

Config files that just work.

Setup day. Shankar moves the settings to the new format.

BeforeRewriting settings by hand

With sdevSwitch formats, nothing lost

  • Woman Developers

    Two heads

    A quick switch, then back to real work.

  • Business Team

    Ready to launch

    The server starts clean on the first go.

How to convert YAML and JSON

  1. Paste or open

    Paste YAML into the Input pane, press Open to pick a .yaml or .yml file, or drop it onto the pane. For the other direction, use the JSON to YAML tab and paste JSON.

  2. Set the options

    Choose the indent, tick Sort keys to order keys alphabetically, or Minify for one-line JSON. The output updates as you type, and a mistake shows its line and column.

  3. Copy or download

    Press Copy, or Ctrl+C with nothing selected, to copy the whole result. Download saves data.json or data.yaml.

Good to know

  • JavaScript-style JSON with unquoted keys, single quotes, trailing commas or comments is repaired before conversion.
  • Files over 2 MB stay out of the editor and are read straight from disk, so large files convert without freezing.
  • Dates such as 2026-09-27 stay as strings in JSON; YAML timestamps are not turned into Date objects.
  • Only the first 1 MB of the result is drawn on screen. Copy and Download always use the full output.

Where people use it

  • Read a config in another tool

    Some tools only take JSON. Turn a YAML config into JSON in one step.

  • Write a config by hand

    Turn JSON into clean YAML that is easier to read and edit.

  • Files with many parts

    YAML files with several documents, anchors and comments are handled for you.

  • Check the YAML first

    If the convert fails, find the wrong line and tidy the file.

    YAML formatter and validator
  • Working with XML too?

    Convert XML to JSON and back on the sister page.

    XML to JSON and JSON to XML converter

Why this one

It copes with the tricky parts of YAML, like anchors and several documents in one file, that simple converters often get wrong.

  • Works both ways on one page.
  • Understands anchors, comments and multi-document files.
  • Large inputs run in the background, so the page stays quick.
  • Nothing is uploaded.

What you can change

  • YAML to JSON or JSON to YAML
  • Indent 2 or 4 spaces, or minify
  • Sort keys

People find this page by searching

  • yaml to json
  • json to yaml
  • convert yaml to json online
  • yaml to json converter
  • json to yaml converter
  • yml to json
  • docker compose yaml to json
  • kubernetes yaml to json
Cite this tool
  • APA
    sdev.in. (n.d.). YAML to JSON and JSON to YAML converter [Web tool]. https://www.sdev.in/tools/yaml-to-json
  • MLA
    "YAML to JSON and JSON to YAML converter." sdev.in, https://www.sdev.in/tools/yaml-to-json.
  • Chicago
    sdev.in. "YAML to JSON and JSON to YAML converter." https://www.sdev.in/tools/yaml-to-json.
  • BibTeX
    @misc{sdev-yaml-to-json,
      title = {YAML to JSON and JSON to YAML converter},
      author = {{sdev.in}},
      howpublished = {\url{https://www.sdev.in/tools/yaml-to-json}},
      note = {Web tool}
    }

Questions people ask

What happens to comments and anchors?

JSON has no comments, so they are dropped. Anchors (&name) and aliases (*name) are resolved, so the JSON contains the full value everywhere the alias was used. Merge keys (<<) are applied too.

My YAML file has several documents separated by ---. What do I get?

A JSON array with one item per document, in order. A single document gives the value itself, not an array.

Why does 'yes' or '012' come out differently from what I expected?

The converter follows YAML 1.2, where only true and false are booleans and a leading zero does not make a number octal. If you need a string, quote it in the YAML.

Does JSON to YAML keep the key order?

Yes, unless you tick Sort keys. Long strings are written on one line rather than folded, so the YAML stays easy to diff.

Is my file uploaded?

No. Parsing and conversion run in a web worker inside your browser. Nothing is sent to a server.

Donate