YAML to JSON Converter

Paste a config file and read the JSON your parser will actually see. Anchors and merge keys are expanded, multiple documents are kept, and a broken file reports the line and column instead of a blank pane.

YAML to JSON conversion workspace

Waiting for YAML
YAML input.yml
JSON output.json
0Keys
0Nesting depth
0Arrays
0Documents
0 BJSON size

What the converter does to your file

YAML is a superset of JSON with a lot of extra spelling. Anchors let one block be reused in five places, merge keys copy defaults into an override, block scalars hold a shell script across ten lines, and a document separator packs six Kubernetes resources into one file. JSON has none of that. Conversion means resolving every shortcut down to plain values, which is exactly what your parser does at deploy time, so the right pane doubles as a preview of what the machine reads.

Anchors and merge keys are flattened, not copied

The sample file defines a defaults block, then pulls it into staging and production with <<: *defaults. Convert it and both environments show the full image name, restart policy and timeout values written out. That expansion is where reused config goes wrong: an override that sits above the merge key silently loses to the anchor in some parsers and wins in others. Seeing the resolved JSON tells you which value survived before a service starts with the wrong timeout.

YAML with an anchor
base: &base
retries: 3
region: eu-west-1
worker:<<: *base
retries: 5
Resolved JSON
{"base": { "retries": 3, "region": "eu-west-1" },"worker": { "retries": 5, "region": "eu-west-1" }}

Types change on the way across

YAML guesses types from how a value is written. JSON has six of them and no room for the rest. Four conversions account for most surprises in a config file.

YAML valueJSON resultWhy it matters
released_at: 2026-03-14"2026-03-14T00:00:00.000Z"A bare date parses as a real timestamp and lands as an ISO string in UTC. Quote the value in YAML if the consumer wants the literal text back
port: 08080"08080"A leading zero stops it being read as a number, so it stays a string and a strict schema rejects it
timeout: .infnullJSON has no infinity or NaN. The tool flags this rather than letting a null slip through unnoticed
enabled: yes"yes"YAML 1.1 read that as true. The 1.2 core schema used here keeps it a string, which is the same behaviour Go and Rust parsers give you

Comments never make the trip. Every # line is dropped, because JSON has nowhere to put it. If the JSON is replacing a checked-in YAML file rather than feeding an API, copy the explanations somewhere before you delete the original.

Multi-document files

A file with --- separators holds several documents. Kubernetes manifests use this constantly, with a Deployment, a Service and an Ingress stacked in one file. Leave Wrap documents in an array on and the output is a JSON array with one entry per document, which is what most tooling wants. Turn it off and only the first document converts, with a note saying how many were skipped. The document counter under the editors tells you what the parser found, so an accidental separator inside a block scalar shows up as a count you did not expect.

Reading an error

A failure reports the line and column from the parser along with the reason. Three causes cover almost everything in real files. A tab character used for indentation, which YAML rejects outright. A duplicate key in the same mapping, which the parser refuses rather than silently picking one. And a value starting with a character that opens a structure, such as an unquoted * or {, which reads as an alias or a flow mapping instead of text.

The line number points at where parsing stopped, not always where the mistake is. An unclosed quote on line 12 usually reports somewhere further down, once the parser runs out of file. Check the lines above the reported one when the flagged line looks fine. For a file you have not written yourself, the YAML validator walks the whole document and lists every problem instead of stopping at the first.

Where this tool stops

Questions that come up mid-conversion

Anchors, dates, multi-document files and the errors people hit with real config.

Are anchors and aliases resolved or kept as references?

Resolved. JSON has no reference syntax, so every alias is replaced by a full copy of the block it points at, and merge keys are applied before the JSON is written. A config that reuses one defaults block across four environments grows in size after conversion, which is normal. The upside is that you see the values each environment ends up with rather than having to trace them by hand.

Why did my date turn into a long timestamp string?

YAML reads an unquoted date such as 2026-03-14 as a real timestamp, and JSON has no date type, so it is written as an ISO 8601 string in UTC. Wrap the value in quotes in your YAML if you want the plain text preserved. The same applies to values that look like times, which is a common surprise in cron and schedule fields.

How are files with several documents handled?

A file split by --- separators is read as a list of documents. With the wrap option on, the output is a JSON array holding one object per document, which suits Kubernetes manifest bundles. With it off, only the first document converts and a note tells you how many were left behind. The document counter under the editors always shows the true number found.

Why does the converter reject my CloudFormation template?

Templates written in YAML use custom tags such as !Ref, !Sub and !GetAtt. Those are application-specific extensions rather than standard YAML, and the parser here has no definitions for them, so the file fails with an unknown tag error. Use a CloudFormation-aware converter, or replace the short-form tags with their full Fn:: object form first.

What causes a duplicate key error?

Two identical keys inside the same mapping. The parser refuses the file rather than picking one, because different implementations pick differently and a silent choice hides a real bug. Merge keys are a frequent source: a block that is merged in and then overridden looks like a duplicate when the override sits at the same level by mistake.

Do the comments in my file survive?

No. JSON has no comment syntax, so every # line is dropped during parsing and cannot be recovered from the output. Keep the YAML file as the source of truth when the comments carry meaning, and treat the JSON as generated output rather than something to edit and keep.

Is the JSON safe to paste into an API request?

The output is valid JSON, so it will parse. Whether the shape matches what the endpoint expects is a separate question, and a converted config often carries extra keys the API ignores or rejects. Check the result against the endpoint schema before sending, and remember that anchors expanded into full copies make the payload larger than the YAML suggested.

Does my file get uploaded anywhere?

No. Parsing runs in your browser through the js-yaml library loaded with the page, and the copy and download buttons work on text already in the tab. No request carries your input, nothing is stored, and closing the tab clears both panes.