Guides · Utiltown
YAML to JSON Converter: Avoid the Norway Problem
YAML is the default for human-edited configuration — Kubernetes manifests, Docker Compose, GitHub Actions, and Ansible all use it. JSON is the default for APIs, OpenAPI schemas, and machine-generated pipelines. Converting YAML to JSON bridges the two: you keep YAML for editing, then emit JSON for systems that consume it.
This guide explains what survives conversion and what does not, the coercion traps to watch for (especially the Norway problem), how multi-line strings are handled, and how to use Utiltown\'s YAML to JSON converter locally in your browser.
Core Concepts
- Data survives, comments do not: JSON has no comment, anchor, or alias syntax. YAML comments and reusable anchors are dropped during conversion; only scalar values, mappings, and sequences survive.
- Coercion traps: YAML 1.1 reinterprets unquoted tokens
like
NO,ON,010, and1:30as booleans, octals, or sexagesimal numbers. Quote every value that is semantically a string before converting, or the output JSON will contain the wrong type. - Multi-line strings: YAML block scalars
(
|,>) become single JSON strings. Newlines are folded or kept per YAML rules, so the JSON string may look different from the source but represents the same text.
How to Use This Site\'s Tool
- Open YAML to JSON.
- Paste your YAML into the input area, or upload a .yaml/.yml file.
- Review the JSON output: check for coerced booleans, numbers, and dates that should have been quoted strings.
- Fix the source YAML with explicit quotes if coercion changed a value.
- Copy or download the JSON result.
Bottom Line
Edit in YAML, ship in JSON. Convert at YAML to JSON, catch coercion surprises before they reach production, and keep everything local and private.
Frequently Asked Questions
Why convert YAML to JSON?
YAML is popular for human-edited config (Kubernetes, CI, Ansible), but JSON is the lingua franca of APIs, OpenAPI schemas, and machine pipelines. Converting YAML to JSON lets you consume hand-written config in systems that only accept JSON.
What is the Norway problem?
YAML 1.1 parsers treat unquoted tokens like NO, ON, OFF, YES as booleans, so country: NO becomes false. Always quote values that are semantically strings before converting to JSON, or coercion bugs will silently corrupt your data.
Are comments preserved?
No. JSON has no comment syntax, so YAML comments, anchors, and aliases are dropped during conversion. Only the data survives; formatting and commentary do not.
Is my data uploaded?
No. This site's YAML to JSON converter runs entirely in the browser. Your YAML is parsed locally and never sent to any server.
What about multi-line strings and block scalars?
YAML block scalars (<code>|</code> and <code>></code>) fold into single JSON strings. Newlines and indentation are normalized according to YAML rules, so the JSON string may look different from the source layout but represents the same text.