Convert YAML to JSON or JSON back to YAML, with the awkward parts handled rather than ignored. Anchors and aliases resolve, multi-document streams parse into an array, and — unusually — merge keys are actually expanded. That last one matters more than it sounds: most converters leave `<<` sitting in the output as a literal property, so a GitLab CI file or a docker-compose config comes out with the wrong shape and you only find out when something downstream breaks. Here the merged mapping is folded in properly, with explicit keys taking precedence exactly as the specification says. Errors point at the line that caused them, tabs get called out specifically because YAML forbids them for indentation and the error it produces otherwise is famously unhelpful, and you are told plainly that comments cannot survive the trip. Everything runs in your browser.
| Feature | Result in JSON |
|---|---|
| &anchor / *alias | Expanded to the referenced value |
| << merge key | Folded in; explicit keys win |
| --- multi-document | An array, one entry per document |
| # comments | Lost — not part of the data |
| | and > block scalars | A single string, folded as written |
| Tabs for indentation | A parse error — YAML forbids them |
| '7' versus 7 | String versus number, preserved |
`<<` folds another mapping's keys into the current one — it is how docker-compose, GitLab CI and Kubernetes manifests share common blocks. Most converters, including js-yaml on its own, leave `<<` as a literal property, so the JSON has a nested `"<<"` key instead of the merged fields. This tool expands it properly, with explicit keys beating merged ones as the spec requires.
YAML does not allow tabs for indentation — only spaces. The parser error for it is unhelpfully indirect, so it is called out explicitly here. Replace the tabs with spaces and it will parse.
They are lost. Comments are not part of the data model, so they cannot be represented in JSON and have nothing to round-trip back from. You are warned when your input contains them, rather than finding out afterwards.
Yes — turn on the multi-document option and each document separated by `---` becomes an entry in a JSON array. Without it, a stream containing more than one document is reported as an error rather than silently giving you only the first.
The data will match, but the formatting will not. Comments are gone, anchors are expanded into their values, quoting style may change, and key order is preserved but block versus flow style is not. Use it to convert, not to reformat a file in place.
No. Parsing happens in your browser. Config files routinely contain hostnames, internal service names and occasionally secrets — none of it is sent to a server, logged, or stored.
Parsing uses js-yaml, which is one of the few dependencies genuinely worth taking: YAML has anchors, aliases, multi-document streams, block scalars, implicit typing and tags, and a hand-rolled parser gets those wrong in ways that corrupt data quietly rather than failing loudly. One thing js-yaml does not do is expand the merge key. An alias resolves, but `<<` arrives as a literal property rather than having its contents folded into the surrounding map — which is wrong for a converter, because merge keys are everywhere in the configuration people actually paste: GitLab CI, docker-compose and Kubernetes manifests all lean on them heavily, and leaving `<<` in the output silently changes the shape of the data. They are therefore expanded here per the specification: the value may be a single mapping or a sequence of them, earlier entries in a sequence take precedence over later ones, and any key written explicitly in the map beats anything merged in. A WeakSet guards against the self-references aliases make possible. Errors are unwrapped from js-yaml's exception so the offending line number can be shown, tabs are called out specifically because YAML forbids them for indentation and the resulting error is famously unhelpful, and comment loss is flagged since comments are not data and cannot survive.