Calcoid

YAML to JSON Converter

Convert YAML to JSON or JSON back to YAML in your browser. Block-style YAML 1.2 subset with literal and folded multiline scalars, scalar typing, and 2 or 4 space indent. Self-contained, no library required.

Convert between YAML and JSON

Direction
Output indent

0 of 100,000 characters.

YAML and JSON Scalar Reference

YAMLJSON valueValue type
active: true{"active":true}Boolean
count: 42{"count":42}Number
name: Calcoid{"name":"Calcoid"}String
value: null{"value":null}Null
count: "42"{"count":"42"}Quoted string

Frequently Asked Questions about the YAML to JSON Converter

Which YAML version does this converter follow?
The converter implements a limited YAML-like subset with YAML 1.2-style booleans, so yes, no, on, and off remain strings. It is not a complete YAML 1.2 parser and does not model the behavior of every tool that reads YAML. Check the supported-features answer before using the output in another system.
Why is YAML indentation-sensitive and what counts as an indent?
Block-style YAML uses leading spaces, and only spaces, to express nesting. The number of spaces is not fixed by the spec: a child must simply be indented more than its parent, and siblings must share the exact same column. The converter follows this rule and rejects tab characters in indentation up front, because tabs and spaces mix unpredictably depending on editor settings. The output indent setting (2 or 4 spaces) controls only the JSON or YAML the tool writes back; the input you paste can use any consistent space count, as long as it is consistent.
Which YAML features does this converter support?
Block-style mappings (key: value), block-style sequences (- item), nested objects via indentation, strings (plain, single-quoted, double-quoted with escape sequences), numbers (integers and decimals with optional sign), booleans (true and false in any common casing), null (null, ~, or empty), comments (# stripped before parsing), the optional --- document start marker, and literal (|) and folded (>) block scalars for multiline strings. Not supported: flow style ([1, 2] or {a: 1}), anchors and aliases (&id, *id), tags (!!str), directives (%YAML), multi-document streams beyond the first, and complex keys. Anything outside the supported subset either fails parsing with a clear error or, for flow style, is treated as a plain string.
Is every valid YAML 1.2 file also valid JSON?
No. YAML 1.2 was designed so JSON documents are valid YAML, but YAML adds syntax that JSON does not support. This converter is only a subset parser and does not accept every valid JSON or YAML construct, including flow-style objects and arrays. Use a conforming YAML parser when full language compatibility matters.
How are multiline strings (| and >) parsed?
A pipe (|) is the literal block scalar: every newline in the indented block is preserved, so a YAML key with a five-line value comes out as a JSON string containing four newline characters. A greater-than sign (>) is the folded block scalar: runs of non-empty lines fold into a single space, and a blank line becomes a newline boundary, which is the right shape for prose that wraps in the source for readability. Both forms use the same indentation rule as the rest of YAML: the body is whatever lines are indented further than the key carrying the marker, and the first such line sets the column for the whole block. Trailing blank lines are clipped by default, which matches the YAML 1.2 default chomping mode.

Related Calculators

More calculators in "Tech"

See all 98 calculators in "Tech"