Category: Developer tools

YAML to JSON Converter

System ideaMissing a tool?

Paste YAML, choose an indent, get JSON, with multi-document streams returned as an array

Paste YAML and convert it to JSON with js-yaml in your browser. Pick 2-space, 4-space or minified output, sort keys, copy the result or download converted.json.

Paste YAML to convert it to JSON.

JSON
The result will appear here.

Everything on this page is processed in your browser. Nothing is uploaded.

What this tool does

This is a one-way YAML to JSON converter. Paste your YAML and the page parses it in the browser with js-yaml's loadAll, then prints JSON. A single document produces one JSON value; a multi-document stream separated by --- produces an array, one element per document, which is what you want when a bundled manifest arrives as several documents in one file. Output can be indented with two spaces, four spaces, or minified to a single line, and object keys can optionally be sorted alphabetically, which makes diffing two configurations far easier. Copy the result in one click or download it as converted.json. When YAML will not parse, the parse error is shown instead of a half-converted result. Several things are deliberately out of scope, and they are precisely the extras competitors bundle. There is no JSON to YAML direction: this page converts one way only. There is no JSON Schema validation and no Kubernetes or OpenAPI validation, so what you learn here is whether the YAML parses, not whether it satisfies a schema. There is no file upload and no remote URL import; pasted text is the only input. Comments and original formatting are not preserved, because JSON has no comments to keep them in. One behavioural note worth knowing: anchors, aliases, tags and scalar typing all follow js-yaml, so aliases are expanded and unquoted scalars are typed by YAML's own rules. Input is bounded by browser memory, with no streaming. Pasted YAML and the converted JSON stay in your browser and are never uploaded to LocalTools.

How to use it

  1. Paste your YAML, either a single document or a --- separated multi-document stream.
  2. Choose 2-space, 4-space or minified JSON output, and sort object keys alphabetically if you need a stable diff.
  3. Copy the JSON or download converted.json; if the YAML will not parse, the error is shown instead.

Privacy

This tool runs entirely in your browser. Your input is never uploaded, stored or shared — closing the tab removes it.

Frequently asked questions

Are YAML comments preserved when converting to JSON?
No. JSON has no comment syntax, so comments are dropped along with blank lines and the original layout. That is a limitation of the target format, not a setting you can change.
Can I convert multi-document YAML?
Yes. Documents separated by --- are all parsed with loadAll and returned as a JSON array, one element per document. A single document returns a single JSON value instead.
Can I convert YAML to JSON without programming?
Yes, that is the point of this page: paste the YAML, pick an indent and copy or download the JSON. No install, no CLI and no code required.
What is the difference between YAML and YML?
Nothing structural. Both are file extensions for the same format, and since input here is pasted text rather than a file, the extension makes no difference to the conversion.
Is conversion done locally, and can it validate a Kubernetes manifest?
Conversion happens entirely in your browser and nothing is uploaded to LocalTools. It checks that the YAML parses, but it does not validate a Kubernetes or JSON Schema, convert JSON back to YAML, or accept file uploads and URLs.