Last updated:
YAML to JSON Converter
Paste YAML or open a file and this YAML to JSON converter writes the JSON as you type, in your browser, and lists every value that changed on the way.
What changed on the way
- 3 values would change in a YAML 1.1 parser (the "Norway problem": in YAML 1.1, NO is false). Turn on YAML 1.1 compatibility to convert them that way.
- Line 2: on is the string "on" here (YAML 1.2), but a YAML 1.1 parser reads it as true. Quote it if it's meant as text.
- Line 5: is null here (YAML 1.2), but a YAML 1.1 parser reads it as the string "". Quote it if it's meant as text.
- Line 20: yes is the string "yes" here (YAML 1.2), but a YAML 1.1 parser reads it as true. Quote it if it's meant as text.
How the YAML to JSON conversion works
YAML and JSON describe the same kinds of data: maps of keys to values, lists, strings, numbers, booleans and null. In fact every JSON document is already valid YAML 1.2. Going from YAML to JSON is therefore mostly a change of punctuation: indentation becomes braces and brackets, unquoted strings get quotes, and the comments disappear. The work is in the places where YAML is more permissive than JSON, because there the YAML parser has to decide what a value means before JSON can write it down.
This converter reads YAML with the yaml package, using the YAML 1.2 core schema unless you turn on YAML 1.1 compatibility. It keeps keys in the order they were written, including keys that look like numbers, which a plain JavaScript object would move to the front. Integers that a JavaScript number holds exactly, which is every integer up to 253, are written as JSON numbers; larger ones such as the ID 12345678901234567890 are written as strings, so the next program that reads the JSON can't silently round them. Errors point at a line and column in the YAML, and the box under the editors says what was dropped or reinterpreted, with the line of each value. Indentation of the JSON can be 2 spaces, 4 spaces or tabs.
YAML gotchas that change your JSON
Implicit typing and the Norway problem
In YAML, an unquoted value is typed by how it looks. true is a boolean, 42 an integer, ~ and null are null, and anything else is a string. YAML 1.1 cast a much wider net: yes, no, on, off, y and n were booleans too. That's the "Norway problem": a list of country codes in which NO turns into false. YAML 1.2, published in 2009, dropped those forms, but many parsers still follow 1.1. PyYAML, the usual YAML library in Python, is one of them. The converter shows each value the two versions disagree on, so you can quote it in the source instead of discovering it in production.
Dates and times
YAML 1.1 has a timestamp type: 2026-03-14 or 2026-03-14 10:30:00 written without quotes becomes a date object in a 1.1 parser, which JSON can only write as a string, and then usually as 2026-03-14T00:00:00.000Z, with a time and time zone the source never had. In YAML 1.2 the same text is just a string, and the JSON keeps it exactly. If a value is a date for people rather than for code, such as a release day or a example: in an API spec, quote it.
Numbers that aren't what they look like
A version written as 1.10 is the number 1.1, and 1.0 is the number 1, so the JSON says 1. File modes and ZIP codes with a leading zero are another trap: 0755 is the number 755 in YAML 1.2, and 493 in YAML 1.1, which reads a leading zero as octal. YAML 1.1 also reads 22:22 as a base-60 number, 1342, which is why Docker's documentation asks for port mappings in quotes. Infinity and not-a-number (.inf, .nan) are valid YAML floats with no JSON form; they're written as null, with a notice.
Several documents in one file
A line with three dashes, ---, starts a new document, which lets one file hold a Deployment and its Service, or several Helm templates. JSON has one value per file, so the converter puts the documents in an array, in order. A trailing --- with nothing after it makes an empty document; it's skipped and counted rather than written as a stray null.
Anchors, aliases and merge keys
&name marks a value as an anchor, *name repeats it, and <<: *name merges an anchored map into another one. JSON can't refer to a value twice, so every alias is copied out in full and every merge is applied. That makes the JSON longer than the YAML, sometimes much longer, and a malicious file can use nested aliases to expand a few lines into gigabytes. The converter stops such a file with a clear error rather than locking up the tab.
Comments, tags and keys
Comments are dropped because JSON has no comments; the converter says so when there were some. Custom tags such as !Ref in CloudFormation templates are reported, and their value is kept as it's written. A key that isn't a string, such as 1: one or a list used as a key, is written as text, since JSON keys must be strings, and two keys that end up the same are reported too.
Examples
Each example opens in the converter above with its link, so you can see the JSON and the notices for yourself, then change the YAML and watch them update.
GitHub Actions workflow: the on key
A workflow's triggers live under the key on. GitHub reads it as the word "on", and so does this converter, but a YAML 1.1 parser reads an unquoted on as the boolean true. A Python script that loads the workflow with PyYAML to check its triggers finds them under True. The same goes for FORCE_COLOR: yes, which is the string "yes" in YAML 1.2 and true in 1.1. Turn on YAML 1.1 compatibility to see both change.
name: CI
on:
push:
branches: [main]
pull_request:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node: [20, 22]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- run: npm ci
- run: npm test
env:
FORCE_COLOR: yes
Open the GitHub Actions example in the converter
Kubernetes Deployment and Service: two documents
Kubernetes manifests often ship as one file with several objects. Converted, this file becomes a JSON array whose first item is the Deployment and whose second is the Service, which is the shape a script needs before it posts each one to the API. The REGION value is quoted in the YAML, so it stays the string "NO" in any parser; unquoted, it would be the string here and false in a YAML 1.1 tool.
apiVersion: apps/v1
kind: Deployment
metadata:
name: web
labels:
app: web
spec:
replicas: 2
selector:
matchLabels:
app: web
template:
metadata:
labels:
app: web
spec:
containers:
- name: web
image: nginx:1.27
ports:
- containerPort: 80
env:
- name: REGION
value: "NO"
---
apiVersion: v1
kind: Service
metadata:
name: web
spec:
selector:
app: web
ports:
- port: 80
targetPort: 80
Open the Kubernetes example in the converter
docker-compose file: an anchor shared by two services
Compose files commonly keep shared settings under an x- key with an anchor, then merge them into each service. The JSON has no anchor left: both services get their own copy of restart and environment, next to their own image. The port mapping is quoted, as Docker recommends, so no parser can read it as a base-60 number.
x-app: &app
restart: unless-stopped
environment:
NODE_ENV: production
LOG_LEVEL: info
services:
api:
<<: *app
image: example/api:1.4
ports:
- "3000:3000"
worker:
<<: *app
image: example/worker:1.4
command: node worker.js
Open the docker-compose example in the converter
OpenAPI 3.1 spec: a date and a version number
Two values in this spec change type on the way. version: 1.0 is a number, so the JSON says "version": 1, while the OpenAPI specification requires a string; write version: "1.0". The example date is a string in YAML 1.2 but a timestamp in YAML 1.1, which would come out as a date-time. The response code is quoted because the OpenAPI specification asks for quotes there, so that YAML and JSON agree; unquoted, 200 is an integer key, which this converter writes as the JSON key "200" but other tools may not accept.
openapi: 3.1.0
info:
title: Orders API
version: 1.0
paths:
/orders/{id}:
get:
summary: Get an order
parameters:
- name: id
in: path
required: true
schema:
type: string
responses:
"200":
description: The order
components:
schemas:
Order:
type: object
properties:
placed:
type: string
format: date
example: 2026-03-14
Open the OpenAPI example in the converter
Which YAML version does your tool read?
The JSON you get depends on the parser, so it's worth knowing which one reads your files. The YAML 1.2 specification is the current one, and libraries written for it, like the one this converter uses, give the strict results you see by default. PyYAML and Ruby's Psych follow YAML 1.1, and other libraries mix the two, for example by accepting 1.2's rules but keeping 1.1 booleans. Rather than learn every parser's rules, write YAML that means the same thing to all of them: quote strings that look like booleans, numbers or dates, quote version numbers, and keep port mappings and file modes in quotes. If the notices under the converter are empty with YAML 1.1 compatibility both off and on, the file is safe either way.
Large and private files
The converter runs as JavaScript in this page. Paste a Helm chart's values, a production Compose file or a spec full of internal hostnames, and none of it is sent to Schema.biz or anyone else. "Open a file" reads the file on your device, up to 5 MB. "Share link" puts the YAML itself in the link, compressed, after the #: browsers don't send that part to servers, but anyone you give the link to can read it, so share it as you'd share the file. Links hold about 32 KB of compressed text; above that the button says the file is too large to share by link.
FAQ
Is my YAML uploaded anywhere?
No. The conversion runs in your browser; a file you open is read on your device, and a share link carries the YAML after the #, which browsers don't send to servers. Like every tool on this site, the converter records what kind of conversion ran: the direction, the options, and counts such as the number of documents, aliases and values YAML 1.1 would read differently. Never the YAML or JSON itself.
Why does NO become false in some tools and stay "NO" here?
YAML 1.1 treats yes, no, on, off, y and n, in any common capitalisation, as booleans. YAML 1.2, which this converter follows by default, keeps only true and false. So a country code like NO is the string "NO" here, and false in a YAML 1.1 parser such as PyYAML. Turn on YAML 1.1 compatibility to convert the way those parsers do; either way, the list under the converter names each value that the two versions read differently.
What happens to a file with several documents?
Documents separated by --- become one JSON array, one item per document, in order. Turn off "Documents as a JSON array" to convert only the first. Empty documents, such as a --- at the very end of a file, are skipped and counted in the notices.
Are anchors and aliases kept?
JSON has no references, so each alias (*name) is replaced by a full copy of what its anchor (&name) holds, and merge keys (<<: *name) are applied, as docker-compose does. A file whose aliases expand to a huge amount of data, the "billion laughs" pattern, is stopped instead of freezing the page.
Can I convert JSON back to YAML?
Yes: the Swap button turns the JSON you just made back into YAML in the same converter, and the JSON to YAML converter starts that way. Comments and anchors from the original YAML don't survive the trip, because the JSON in between can't hold them.
Related tools and guides
- JSON to YAML Converter: the reverse direction, with strings quoted so YAML 1.1 parsers can't misread them.
- OpenAPI Editor: edit the spec you just converted, in YAML or JSON, with a live preview of its endpoints.
- OpenAPI Validator: check a YAML or JSON spec against the official OpenAPI schema, including the values that changed type, such as an unquoted version.
- JSON Schema Validator: check the JSON from a converted config file against its schema, to catch the type changes described above.
- Schema Converter: turn JSON Schema, or a JSON example such as this converter's output, into TypeScript, Zod, Pydantic or Go.
- API Tools: every tool for JSON, JSON Schema and OpenAPI on Schema.biz.