ToolsMaxxing

JSON and YAML converter

Convert JSON to YAML and YAML back to JSON, with the line and column of any syntax error.

Your files stay on your device

How it works

  1. 1Choose JSON to YAML or YAML to JSON.
  2. 2Paste your text, or choose Try an example.
  3. 3Pick the indent width.
  4. 4Copy the result or download it.

What the options do

JSON to YAML
Reads strict JSON and writes block-style YAML. Long strings are not wrapped.
YAML to JSON
Reads the first YAML document and writes formatted JSON.
Indent
Two or four spaces per level in the output.

Privacy

Everything runs in your browser. What you paste is never sent to a server. That is safe for config files with internal hostnames.

Questions people ask

Are YAML comments kept when I convert to JSON?

No. JSON has no comments, so they are dropped. Converting back to YAML will not restore them.

Why did my YAML value turn into a number or boolean?

YAML decides the type from the text. A bare 123 is a number, true and false are booleans, and null or ~ is null. Put quotes around the value, for example "123", to keep it as a string.

Does it handle multi-document YAML?

Only the first document, the part before the first --- separator line, is converted. Split a file with several documents first.

Are anchors and aliases supported?

Reading YAML with anchors (&name) and aliases (*name) expands them into plain copies in the JSON. Writing YAML from JSON never creates them.

What does the error message mean?

The line and column point at where the parser got stuck. In YAML the usual cause is wrong indentation or a tab character, since YAML only allows spaces for indentation.

Related tools