Tools

JSON to YAML converter

Convert JSON to YAML and YAML back to JSON, in either direction.

Runs in your browserData formats1.7K
Free

Input

0 BFree up to 50.0 KB

Result

The result will appear here.

Your runs

Only runs that cost points are saved.

Sign in to keep a history of your runs.

Most configuration now arrives as YAML and most APIs still speak JSON, so the conversion between them is a daily chore. This runs it in both directions using the same YAML implementation that Node tooling uses, which means anchors, multi-line scalars and explicit types survive the trip instead of being flattened into strings.

How it works

  • Conversion runs in your browser on the eemeli/yaml parser, the reference implementation for YAML 1.2 in JavaScript.
  • Going to JSON, YAML comments are dropped, because JSON has nowhere to put them.
  • Indentation applies to whichever side you are producing.

Where your data goes

Nowhere. This tool runs entirely in your browser: the text you paste is processed by the page and is never transmitted to a server or written to a log.

When a run costs points, a one-line summary is saved to your own history so you can find it again. The summary records the shape of the run — sizes, counts, the values you looked up — never the content you pasted.

What it costs

Free up to 50.0 KB per run without an account. Past that, a run costs 1 points and is saved to your history.

Points come from signing up, checking in daily, commenting and completing your profile.

See how points work

Common questions

Will my YAML comments survive the round trip?
No, and no converter can make them. JSON has no comment syntax, so a comment has nowhere to live once the document becomes JSON, and nothing to be restored from on the way back.
Why did my version number become a string?
YAML reads an unquoted 1.10 as the number 1.1, which silently loses the trailing zero, and treats an unquoted 1.2.3 as a string because it is not a number at all. The inconsistency is the trap. Quote version numbers in YAML and they convert exactly, every time.
Does this handle multi-document YAML?
It converts the first document. A file separated by --- into several documents has no single JSON equivalent, so splitting it is a decision the tool leaves to you.

The open-source behind it

This tool runs on eemeli/yaml, released under ISC. If you need the same behaviour inside your own program, that is the library to reach for.

eemeli/yaml

Also known as

  • json to yaml
  • yaml to json
  • yaml converter
  • convert json yaml online
  • yaml formatter