Skip to main content
NeatUtility

JSON to YAML & YAML to JSON Converter

YAML, TOML & Config100% Client-Side
Ready
JSON
0 lines0 chars
0 B / 4.77 MB
About this tool, examples & FAQ

Convert JSON to YAML or YAML back to JSON on one page, entirely in your browser, with 2- or 4-space indentation and optional recursive key sorting. YAML comments do not survive conversion, and some YAML values have no exact JSON equivalent.

Key facts

Verified capabilities and limits of this utility
Conversion directionsTwo operations: JSON to YAML (default) and YAML to JSON
Formatting optionsIndentation of 2 or 4 spaces, with optional recursive key sorting
Max input size5 MB
Execution deadline3 s
Processing locationBrowser-only: pasted input is not uploaded

How to use

  1. Paste a JSON or YAML document into the editor.
  2. Select the conversion direction: 'JSON to YAML' or 'YAML to JSON'.
  3. Choose 2- or 4-space indentation and set key sorting if needed.
  4. Click 'Run' to perform the conversion.
  5. Use 'Copy' or 'Download' to retrieve the converted output, or use 'Send To' to pipe it into another utility.

Examples

JSON to YAML

Input

{"name":"Ada","enabled":true}

Example output

name: Ada
enabled: true

YAML to JSON

Input

name: Ada
enabled: true

Example output

{
  "name": "Ada",
  "enabled": true
}

Edge cases

Comments are dropped

YAML comments are discarded when converting to JSON, which has no comment syntax. Comments are also not preserved through a YAML to JSON to YAML round trip.

Anchors and aliases

Anchors and aliases are expanded during parsing with a cap of 100 alias resolutions; excessively aliased input is rejected to prevent exponential expansion.

Merge keys not merged

YAML merge keys using '<<' are not specially merged; they arrive as an ordinary '<<' property in JSON. Expand merges before converting if you need merged mappings.

Duplicate keys rejected

Duplicate keys in YAML input are rejected with an error instead of silently keeping one value.

Single document only

Multi-document YAML input is rejected; convert one document at a time.

Lossy scalars

Integers beyond 2^53 and non-finite values such as .nan and .inf have no exact JSON representation and may convert lossily or to null.

How it works

  1. JSON to YAML parses the input as JSON, then serializes it as YAML with the selected indentation.
  2. YAML to JSON parses the input with the YAML parser under an alias-expansion cap, then serializes the result as indented JSON.
  3. Key sorting, when enabled, orders object keys recursively using locale-aware comparison.
  4. Executes inside a Web Worker bounded by the tool deadline.

Frequently asked questions

What can be lost when converting?

YAML comments are always dropped, anchors and aliases are expanded rather than preserved, and integers beyond 2^53 or non-finite values may convert lossily. Duplicate keys and multi-document input are rejected outright.

Do YAML comments survive conversion to JSON?

No. JSON has no comment syntax, so comments are necessarily dropped during YAML to JSON conversion.

Are YAML anchors and aliases supported?

Anchors and aliases are expanded during parsing, with at most 100 alias resolutions. Input exceeding that cap is rejected to prevent denial-of-service through exponential expansion.

Which JSON types round-trip cleanly?

Objects, arrays, strings, numbers, booleans, and null convert in both directions. Anything outside that set, such as YAML timestamps or binary tags, arrives in JSON as the parser's best representation, not the original tag.

Why did my booleans or numbers change type?

Unquoted YAML scalars are typed by the parser, so a value that looks numeric or boolean in YAML may arrive as a different JSON type than you expect. Quote a scalar to keep it a string.

Is my pasted input uploaded anywhere?

No. Conversion runs inside an isolated Web Worker in your browser, and pasted input is not uploaded for processing. The browser still requests site assets from the host; clipboard, downloads, and analytics are separate boundaries.

References