UtilHero

YAML to JSON

Convert YAML to JSON and JSON back to YAML.

JSON output

About YAML to JSON

A YAML to JSON converter turns YAML — the indentation-based format used for config files — into JSON, and converts JSON back to YAML. Paste your input, pick a direction, and get formatted output instantly, with a clear message pointing to any syntax error. It runs entirely in your browser, so private config never leaves your device.

The same data, two philosophies

YAML is a superset of JSON, which means any valid JSON is already valid YAML. What YAML adds is human comfort: indentation instead of braces, dashes for list items, comments, and no need to quote most strings. That is why it won the configuration-file argument — Kubernetes manifests, CI pipelines, and Docker Compose files are all far easier to read as YAML than as nested JSON.

JSON's advantage is that it is unambiguous and trivially machine-parsable. Every parser agrees on what a JSON document means. YAML is a much larger specification with more ways to express the same thing, and parsers differ at the edges — which is the source of most surprises when converting between them.

Indentation is the syntax

In YAML, indentation determines structure, so whitespace is not cosmetic. Two spaces of indent means a child; going back out means the block ended. This is why a single misaligned line can silently change a key's parent and produce a valid document that means something entirely different from what you intended.

Tabs are forbidden outright — the specification only allows spaces — which trips up anyone whose editor inserts tabs. If a YAML file fails to parse with an error you cannot see, check for tab characters first. Consistent two-space indentation and an editor configured to expand tabs prevents nearly all of it.

The Norway problem and other type surprises

Older YAML parsers interpret unquoted no, off, and n as boolean false, and yes, on, and y as true. The famous consequence is that a list of country codes containing NO for Norway parses as the boolean false. The 1.2 specification narrowed this to just true and false, but plenty of tools still implement 1.1 behaviour.

Other unquoted values bite similarly. A version number like 1.10 parses as the float 1.1, losing the zero. A value beginning with a zero may be read as octal. A time like 12:30 can become a sexagesimal number. The defence is simple and worth making a habit: quote any string whose meaning depends on being a string.

What is lost in each direction

Converting YAML to JSON discards comments, because JSON has no way to represent them. On a configuration file that is often the most valuable content — the note explaining why a timeout is 45 seconds. Anchors and aliases, YAML's mechanism for reusing a block, are expanded into duplicated data, so the relationship between them disappears.

Going the other way is cleaner, since JSON has no features YAML lacks, but the output will be more verbose than hand-written YAML — quoted keys everywhere and no comments to add back. Treat conversion as one-way for anything maintained by hand: generate JSON from YAML for machines, and keep the YAML as the source of truth.

Frequently asked questions

Is my YAML or JSON uploaded anywhere?
No. The conversion happens in your browser — nothing is sent to a server, so it's safe for private configs and secrets.
Does it convert both directions?
Yes. Switch between YAML → JSON and JSON → YAML with one click. Both directions validate the input and report the first syntax error.
Why did I get a parsing error?
YAML is whitespace-sensitive — inconsistent indentation, tabs instead of spaces, or a missing colon are the usual causes. For JSON, watch for trailing commas and single quotes. The error message names what went wrong.
Unit ConverterAWG to mm²NetToolkitClick CounterClick TestTyping Speed TestReaction Time TestKeyboard TesterDead Pixel TestMic TestWebcam TestPassword GeneratorPassword Strength CheckerID GeneratorStopwatchTimerCountdown to DateTodo ListOnline NotepadWheel SpinnerRandom Number GeneratorCoin FlipDice RollerWord CounterJSON FormatterJSON VisualizerCSV to JSONSQL FormatterCron Expression GeneratorChmod CalculatorQR Code GeneratorBarcode GeneratorPercentage CalculatorGPA CalculatorGrade CalculatorScientific CalculatorAge CalculatorRoman Numeral ConverterBase64 Encode / DecodeNumber Base ConverterText to BinaryMorse Code TranslatorSymbols & EmojiCase ConverterText to SpeechText RepeaterFancy Text GeneratorHash GeneratorURL Encode / DecodeUnix Timestamp ConverterTime Zone ConverterColor PickerColor ConverterLorem Ipsum GeneratorBMI CalculatorBMR & Calorie CalculatorTip CalculatorJWT DecoderJWT EncoderRegex TesterUTM BuilderSERP SimulatorOpen Graph GeneratorDynamic QR Code GeneratorSlugifyText DiffRemove Duplicate LinesDiscount CalculatorSales Tax CalculatorLoan CalculatorCompound Interest CalculatorMortgage CalculatorTime Duration CalculatorContrast CheckerGradient GeneratorBox Shadow GeneratorBorder Radius GeneratorFlexbox & Grid GeneratorPalette GeneratorTints & ShadesImage to Base64Aspect Ratio CalculatorImage ResizerHEIC to JPGAVIF to JPGAVIF to PNGFavicon GeneratorInvoice GeneratorPDF ToolsRotate PDFDelete PDF PagesReorder PDF PagesAdd Page NumbersWatermark PDFPDF to JPGPDF to Text