Skip to content
ToolDesk

YAML ⇄ JSON

Convert YAML to JSON and JSON to YAML. Handy for inspecting and converting config files.

Dev

About this tool

YAML and JSON express very similar data structures, so they convert mechanically. This tool converts both ways in your browser and never sends your input anywhere. YAML is readable, but it has a few error-prone quirks, so here are the points worth knowing when you convert.

Indentation is everything (no tabs)

YAML expresses hierarchy through the number of leading spaces. Tab indentation is not allowed, and stray full-width spaces break it. A single misaligned level can change the structure or cause an error, so watch the kind of whitespace when you paste.

The "Norway problem": no and off become booleans

In YAML, values like yes, no, true, false, on, and off can be interpreted as booleans. Writing the country code NO (Norway) and getting false back is a famous pitfall. To keep it as a string, wrap it in quotes as "NO".

Numbers and dates are auto-interpreted too

Unquoted values have their type guessed — 010 as octal, 2024-01-01 as a date, and so on. To keep a leading-zero code or a date-like string as plain text, wrap it in quotes.

Comments and anchors do not exist in JSON

YAML comments starting with #, and references like &anchors and *aliases, have no equivalent in JSON. Converting YAML to JSON drops comments and expands anchors. Keep any needed notes separately.

How to use

  1. Choose "YAML → JSON" or "JSON → YAML".
  2. Paste your data to convert it instantly.
  3. Click "Copy result" to grab the output.

FAQ

Is the data I enter sent anywhere?

No. Converting between YAML and JSON runs entirely in your browser (JavaScript), and your input is never sent to a server. It is safe even if the config file contains sensitive information.

Are YAML comments kept after conversion?

No. JSON does not support comments, so converting from YAML to JSON drops lines starting with #. It is best to keep any needed notes separately.

Can it convert in both directions?

Yes. It supports both YAML to JSON and JSON to YAML. It converts based on the input format, useful for inspecting config files or standardizing formats.

What happens with misindented YAML?

Because YAML expresses hierarchy through indentation, a slip can change the structure or cause an error. Watch especially for mixing tabs with spaces or stray full-width spaces, and review the input if an error appears.

Can I format the resulting JSON to be more readable?

This tool is for conversion. To indent or minify the resulting JSON, use it together with the JSON formatter.

Can it convert JSON with comments (JSONC)?

Standard JSON does not allow comments, so JSON containing // or /* */ cannot be handled as-is. Remove the comments first and try again.