How to convert YAML and JSON

Choose the direction, paste your text and press Convert. Going from YAML to JSON you can pick the indent width or minified output; going from JSON to YAML the output is block style with two-space indentation. The conversion runs on the button, not on every keystroke. You can copy the result or download it as a file.

Before returning a result, the tool reads its own output again and checks that it describes the same data as the input. If they differ, nothing is returned and an error is shown.

Supported subset

The tool accepts the part of the YAML 1.2.2 core schema that JSON can express: a single document with null, boolean, string, finite number, array, and mapping with string keys.

ConstructBehavior
More than one documentError
Aliases and anchorsError, never expanded
TagsError
Merge keysError
Non-string keysError
Duplicate keysError
Unsafe integers, infinity and not-a-numberError
CommentsLost in JSON, with a warning

The order of mapping entries is not a semantic guarantee. The tool keeps the source order, but whatever reads the data should not rely on it.

Why aliases, tags and duplicate keys are errors

Aliases and anchors reuse a value elsewhere. Nested alias chains can turn a tiny text into a huge dataset; this first version closes that risk with a zero expansion limit and stops at the first alias. Tags and merge keys also mean different things to different parsers. Duplicate keys silently let the last value win in many tools and cause unnoticed configuration bugs. The tool stops instead and shows the position as line and column.

Numbers, on and yes, leading zeros

In the YAML 1.2 core schema only true and false (with their capitalized spellings) are booleans; on, off, yes and no are strings. That is why the on: key in GitHub Actions files stays "on" in JSON and does not become true. YAML 1.1 loaders may read those words as booleans, so when converting JSON to YAML these values are quoted.

Numbers with a leading zero are ambiguous: 007 may be octal in YAML 1.1, is decimal seven in 1.2 and is invalid in JSON. The tool treats that spelling as an error; write "007" if you want text. Hexadecimal 0x1F, octal 0o17, .inf and .nan do not exist in JSON and are rejected. Integers are limited to the safe range of double-precision numbers (up to 9007199254740991). Larger integers are rejected even with exponent or decimal notation. Decimal text must survive a JavaScript number round trip with the same decimal value; this does not mean values such as 0.1 are exact in binary floating point. In the JSON direction the same check runs on the text itself, not after JSON.parse.

Example conversion

The YAML below becomes the JSON in the second box with this tool. The comment line is lost, on stays a string key, and the multi-line text written with | keeps its final newline.

# Example configuration
name: Nightly build
on:
  schedule:
    - cron: "0 3 * * *"
version: 1.5
enabled: true
notes: |
  Two lines
  of notes
{
  "name": "Nightly build",
  "on": {
    "schedule": [
      {
        "cron": "0 3 * * *"
      }
    ]
  },
  "version": 1.5,
  "enabled": true,
  "notes": "Two lines\nof notes\n"
}

Limits and privacy

  • Input can be at most 100 KiB of UTF-8, nesting at most 50 levels and the total node count at most 10,000; these are design limits of this tool.
  • If a very deep structure strains the parser stack, the tool shows a depth error instead of crashing.
  • If your configuration contains real passwords or keys, replace them with placeholders; the tool stores nothing, saves nothing and never puts content in the share link.
  • The Share button adds only the direction and indent settings to the link.
  • If the parser cannot be loaded from the local file, the tool shows an error and downloads stay disabled.

Sources and verification

Parsing uses the ISC-licensed yaml 2.9.1 library and the YAML 1.2.2 core schema; on the JSON side a strict scanner specific to this tool is used. The library, its version, its licence and its security status were reviewed on 25 October 2026 and are kept on this site as a local file. The conversions were tested against hand-written expected JSON examples that do not rely on the parser's own output.

Frequently asked questions

Do YAML comments carry over to JSON?

No. JSON has no comments, so comments and YAML-specific formatting are lost. When the tool finds a comment it tells you with a warning.

Why are aliases and anchors not supported?

Alias chains can expand a tiny text into a huge dataset. This first version never expands an alias, so the risk does not exist. Open a file that uses aliases with another tool first and turn them into plain values.

Why does on: not become true?

The YAML 1.2 core schema treats on and yes as strings. The tool follows that rule, so the on key in GitHub Actions files stays a string in JSON.

Why do my large numbers give an error?

Most JSON software reads numbers as double-precision values. Integers above 9007199254740991 or decimals whose precision would be lost can be rounded silently; failing instead of losing data silently is a deliberate choice of this tool. Write long identifiers as strings.

Is my configuration sent to a server?

No. The conversion runs in your browser and the text is never added to a server, storage or the share link. Still, I recommend using placeholders instead of real passwords and keys.

Published: · Updated: