Convert JSON to YAML or YAML to JSON. Paste multiple YAML documents separated by --- to convert a batch to a JSON array in one pass.
YAML natively supports multiple documents in a single file or stream, separated by a line containing just --- — a pattern common in Kubernetes manifests, Docker Compose overrides, and CI pipeline configs that bundle several related definitions in one file. When "YAML → JSON" is selected and the input contains one or more --- separators, every document is parsed and the result is a JSON array, in the same order they appeared — a single document (no separator) converts to a plain JSON object instead, not a one-item array.
JSON and YAML can represent the same underlying data — objects, arrays, strings, numbers, booleans, null — but YAML adds things JSON has no equivalent for: comments (#), anchors and references (&name / *name, for reusing a value in multiple places without repeating it), and multiple representations of the same scalar (an unquoted string, a quoted string, and a block scalar can all produce identical parsed output). Converting JSON to YAML never loses anything, since JSON is a strict subset of what YAML can express. Converting YAML to JSON can lose comments and anchor/reference structure, since JSON has no way to represent either — anchors get resolved to their expanded values in the JSON output, and comments are simply dropped.
YAML uses indentation to represent nesting, and unlike most languages, it's strict about consistency — mixing tabs and spaces, or shifting indent width partway through a block, is a parse error rather than something the parser silently corrects. Re-indent the offending block consistently (spaces only, same width throughout) and it should parse.
Yes, both directions preserve the order keys appear in the source, since neither JSON nor YAML objects have a defined "correct" order — the parser used here (js-yaml) reads and writes them in document order rather than sorting alphabetically.
No. Both directions run using the open-source js-yaml library loaded once from a CDN, then execute entirely in your browser — no network request happens with your actual input data, which you can confirm in your browser's dev tools Network tab.