Cookies This site keeps only what it needs to work. There is no analytics and no advertising on it today, and nothing here follows you to other sites. Read the privacy policy

Choose what to allow
+92 312 8299940Free Quote
EN – Language: English
Free tool, runs in your browser

YAML to JSON Converter
Config Files Your Code Can Read

Paste a config, a CI pipeline or a manifest into this YAML to JSON converter and get exact JSON back, with anchors resolved and indentation checked.

  • FreePrice
  • JSONOutput
  • NoneSign-up
  • In your browserRuns

YAML to JSON Converter

Converted in your browser, with every issue listed

Records
0
Depth
0
Size
0 B

Ready. Paste your data, open a file or try the sample.

Going the other way? Convert JSON to YAML

Your browser does all of the work here, in this tab. We upload nothing, store nothing and log nothing.
Add a link to this tool on your own site

Copy the code below and drop it into your page. It places a link to this free tool.

Guides for this tool

Articles with worked examples, tables and a short video that help you get more from this tool.

The basics

Jobs This YAML to JSON Converter Handles for You

This YAML to JSON converter reads a YAML document and writes the same data as JSON. Indented keys become nested objects, dash lists become arrays, and every value lands in the right place. Nothing gets uploaded, because your browser does the reading.

YAML is popular for settings because people can write it by hand. Docker Compose files, GitHub Actions, Kubernetes manifests and many app configs use it. Yet the same freedom makes it easy to get wrong: one extra space moves a key to a different parent, and nobody notices until something breaks.

JSON avoids that confusion entirely. So converting a file is a quick way to see exactly what a YAML parser will understand. If a key sits in the wrong place, the JSON shows it at once.

How YAML Becomes JSON

Indentation decides the nesting. A key followed by more-indented lines becomes an object, and lines that start with a dash become a list. Flow style works too, so [80, 443] and {host: db, port: 5432} read exactly like their block versions.

Diagram of a YAML service config turned into JSON: nested keys, a dash list as an array and a pipe block kept intact
Indentation becomes nesting, dashes become arrays, and block text keeps its lines.

Block scalars keep long text intact. A value that starts with a pipe keeps its line breaks, while one that starts with a greater-than sign folds the lines into one. The converter follows both rules, including the chomping signs that decide what happens to the final line break.

Reusing YAML Blocks: Anchors, Aliases, Merge Keys

Large configs repeat themselves, so YAML lets you name a block with an anchor such as &defaults and reuse it later with *defaults. The merge key goes one step further: <<: *defaults copies every setting into a new block, where you can then override a few of them.

YAML to JSON converter resolving a defaults anchor with a merge key, writing the merged settings out in full
The converter writes anchors and merge keys out in full, with your overrides on top.

JSON has no references, therefore the converter writes each copy out in full. Merged keys come first, and your own keys override them, which is exactly how YAML tools apply them. If an alias points at an anchor that does not exist, the converter stops and names the line.

Convert YAML to JSON Without the Norway Problem

Older YAML readers turn words such as yes, no, on and off into true or false. A country list with NO for Norway then becomes false, and a setting called on flips a switch by accident. Developers call this the Norway problem.

YAML to JSON output where the country code NO stays a string, hexadecimal 0x1F becomes 31 and a long ID keeps every digit
NO stays the text NO, while real numbers and booleans get proper JSON types.

This converter follows the core schema of the YAML 1.2 specification. Only true and false become booleans, and only null or ~ becomes null. The converter reads numbers such as 0x1F or 0o17 as hexadecimal and octal, and long integers keep every digit.

Common YAML Files You Can Convert

A Docker Compose file turns into one object per service, with its image, ports and volumes as keys. That makes it easy to spot a port listed twice or a volume under the wrong service.

Converting a workflow in GitHub Actions into a job and step structure is a fast method of confirming that each step is located correctly within the appropriate job. A simple spacing error can cause a step to be placed in an unintended location. This also applies to Kubernetes manifests, Ansible Playbooks and OpenAPI Definitions.

The most common use of application configurations is as a way to store settings (e.g. database connection details, cache settings, feature flag configurations) in a format such as YAML. But many developers prefer to write their test cases using JSON. As such, by providing a user with a single copy/paste, they can get the configuration in both formats, with the exact same data.

Files With --- Separators and Several Documents

The three dashes in a YAML file separate different documents within that file. Many Kubernetes manifest files contain multiple documents. The converter reads the first document and will let you know in its "checks" that there were extra documents in the file, which means that none of your data was lost.

YAML files contain comments, which are lost when converting to JSON because JSON does not support commenting. If you will need to reference your comments at a later time, you should use YAML as your source and consider the conversion to JSON as a "build" step.

Tabs, Bad Indents and Other Errors

YAML prohibits tabs for indentation, but editors are constantly placing tabs in documents. The converter will find each tab, and each line that has been indented past the other lines in that same section of code, and it will give the specific line and column of the issue. After that, Show me where puts the cursor at the point of the problem.

The YAML to JSON converter reporting a tab used for indentation, with the line and column and the Show me where button
A tab in the indentation is caught with its exact line and column.

YAML to JSON Online for Everyday Work

DevOps Engineers will post a manifest to verify that it is properly formatted before being used. Developers on the backend will make a configuration file into JSON for either testing purposes or an API call. Technical Writers will format example files so they are available in both formats for users to see them as such within the documentation.

JSON, as a format, is specified by RFC 8259. The resulting output will be compliant with this specification. If you are looking for the reverse process, check out our JSON to YAML converter. This tool creates cleanly formatted YAML using safe quoting techniques.

Video guide

Using the YAML to JSON Converter: A Short Video Guide

This brief video shows each step from start to finish. Choose your language below, and switch on captions if they help.

Four steps

Turning YAML Into JSON on Denwix

Most config files convert before you have finished pasting them.

  • Paste the YAML

    Use the input box, drop a .yaml or .yml file on it, or open one. The sample is a small service config.

  • Watch it convert

    The JSON will update with every single key that you type. Files which are extremely large will wait for you to click on the Convert button before updating.

  • Read the checks

    See duplicate keys, extra documents and anything else worth a look.

  • Take the JSON

    Copy it or download a .json file, indented or on one line.

Why this one

A Stricter, Safer YAML Reader

A config file deserves a reader that tells you when something is off.

  • YAML 1.2 core schema

    No surprise booleans from yes, no, on or off.

  • Anchors resolved

    The tool writes aliases and merge keys out in full, overrides included.

  • Exact big numbers

    Long integers keep every digit instead of rounding in the browser.

  • Duplicate keys flagged

    The checks report a key that appears twice in one mapping, with its line.

  • Precise errors

    Tabs and stray indents stop the conversion with a line and column.

  • Secrets stay local

    Configs often hold keys and hosts, so nothing leaves your machine.

Good habits

Rules for YAML That Converts Cleanly

These habits prevent the mistakes that YAML makes easy.

  • Indent with spaces only. Two spaces per level is the common choice, and tabs are never allowed.
  • Line up keys at one level with the same indent. Keys that belong together must start in exactly the same column.
  • Type key: value with a space, never key:value. The format should be key: value, as the format key:value will count as a single string.
  • Put quotes around values that could be read as something else. Quotes must surround all version numbers such as "1.10" and code numbers such as "0123" so that they remain in the form of text.
  • Quote text that starts with symbols. Values starting with *, &,!, @, % or ` will need quotes so they can be treated as plain text.
  • Name anchors clearly. An anchor such as &db-defaults explains itself wherever the alias appears.
  • Use one document per file when you can. Tools differ in how they handle several documents, so fewer surprises follow.
  • Never keep a secret in a shared file. Passwords and tokens belong in a secret store, not in YAML under version control.
Easy to miss

Six YAML to JSON Mistakes

Each one produces valid-looking JSON with the wrong meaning.

  • A key that’s one space off

    The key silently moves under another parent and changes what it controls.

  • Norway turned false

    Old readers treat NO as a boolean, so a country code disappears.

  • Versions losing zeros

    An unquoted 1.10 becomes the number 1.1, which is a different version.

  • Tabs from an editor

    One tab breaks the file, even when it looks aligned on screen.

  • Aliases left unresolved

    A converter that ignores anchors leaves settings missing from the JSON.

  • Missing the second document

    Content after --- is easy to overlook, so read the checks.

Questions

Questions People Ask About YAML To JSON

What are the steps to turn YAML into JSON on Denwix?

Put the YAML in the input box or open the file. The JSON appears beside it straight away, ready to copy or download.

Can the converter resolve YAML anchors and aliases?

Yes. The converter resolves anchors, aliases and merge keys, and the JSON contains the full values.

Why did the converter keep yes as text?

The converter reads YAML 1.2 rules, so only true and false count as booleans. That avoids the Norway problem.

What happens to comments?

JSON has no comments, so the converter leaves them out. Your YAML file keeps them, of course.

Can it read a Kubernetes or Docker Compose file?

Yes. Both are plain YAML. For a file with several documents, the converter reads the first and tells you that more followed.

Why does a tab cause an error?

The YAML specification forbids tabs for indentation, because they look different in every editor. Replace them with spaces.

Do long numbers stay exact here?

Yes. Integers keep every digit in the JSON, even when they are longer than JavaScript can hold.

What does the converter do with a repeated key?

The last value wins, as in most YAML tools, and the checks list the key and its line so you can fix it.

How do YAML and JSON differ in practice?

Strings, numbers, lists and maps exist in both. YAML uses indentation and allows comments, which makes it pleasant to write by hand. JSON uses brackets and quotes, which makes it strict and easy for programs to read.

Can I turn the JSON back into YAML?

Yes. Our JSON to YAML converter writes the data back as clean YAML, and it quotes values such as NO or 1.10 so they keep their meaning.

Why did a version number change?

An unquoted value such as 1.10 is a number, and the JSON reader of your app may show it as 1.1. Put quotes around versions in the YAML to keep them as text.

Does it support block text with | and >?

Yes. The pipe keeps every line break, the greater-than sign folds lines into one, and the - and + signs control the final line break.

Can I check a YAML file for errors without converting it?

Converting is the check. If the YAML has a problem, the tool stops with the line and column, so a clean result means the file reads correctly.

How large a file will this Denwix tool accept?

Files running to several megabytes pose no problem. Very large input converts when you press the button rather than on every keystroke.

Does my config file ever leave this Denwix page?

No. Only your browser performs the conversion, so keys, hosts and passwords never leave your device.

Related tools

More Tools for Config and Data Files

Handy before and after the conversion.

Ready to See Your YAML as JSON?

Paste the YAML and exact JSON appears at once. The YAML to JSON converter is free, needs no account and keeps your config on your device.

Prefer Denwix on GoogleReview Denwix on Google