JSON Tools Hubjsontoolshub.com

YAML to JSON Converter

Convert YAML configuration documents into standard 2-space JSON while respecting YAML 1.2 boolean semantics and alias safety guards.

YAML to JSON Converter

Input0 chars
Line 1, Col 1

YAML to JSON parsing rules

The YAML to JSON Converter uses js-yaml (YAML 1.2 Core Schema) to parse a single YAML document into 2-space formatted JSON. Under YAML 1.2, only true and false parse as booleans, while yes, no, on, and off stay strings. Standard non-cyclic *aliases to &anchors are resolved, whereas cyclic anchors (*loop), extreme alias bombs, and multi-document --- streams return explicit errors.

Features and output

  • Follows YAML 1.2 Core Schema: only true/false are booleans; yes/no/on/off stay strings
  • Expands standard YAML &anchor / *alias nodes safely into JSON values
  • Detects cyclic aliases (a: &loop [*loop]) and excessive node expansion before serializing
  • Supports .yaml and .yml local file upload with line-specific YAML parse error reporting

When to use this tool

  • Convert YAML OpenAPI definitions, CI config, or service specs to JSON
  • Check how unquoted YAML scalars (yes, no, 001, timestamps) decode under YAML 1.2
  • Verify YAML syntax and anchor expansion before sending JSON to APIs

Practical example

Sample Input
a: yes
b: off
c: true
d: "001"
Expected Output
{
  "a": "yes",
  "b": "off",
  "c": true,
  "d": "001"
}

Verified under js-yaml (YAML 1.2 Core Schema): unquoted yes and off stay strings rather than turning into booleans, while c parses as true.

Common errors & troubleshooting

  • Multi-document YAML streams containing multiple --- documents fail because single-document JSON expects one root value.
  • Cyclic anchor references (a: &loop [*loop]) cannot be expressed in JSON and return an explicit cycle error.
  • Tab indentation errors inside YAML mappings raise YAMLException syntax errors with line numbers.

Limitations & edge cases

  • JSON cannot retain YAML comments, custom tags, or non-string mapping keys.
  • YAML 1.1 merge keys (<<) are treated literally as key "<<" under strict YAML 1.2 Core Schema.
  • Node expansion is bounded (500,000 nodes max) to protect your browser against alias-expansion bombs.

Developer tip: Quote YAML strings explicitly whenever identifiers or version numbers (like 1.10 or 001) must remain strings across both YAML 1.1 and 1.2 tools.

How to use YAML to JSON Converter

  1. 1Paste a single YAML document into the input pane or drop a .yaml / .yml file.
  2. 2Click Convert to JSON (or press Cmd/Ctrl + Enter).
  3. 3Inspect scalar types in the output pane and Copy or Download the resulting .json file.

Privacy note: Processing runs locally in your active browser tab. Avoid pasting live production secrets or tokens.Verified against implementation: November 2026

YAML to JSON Converter Reference

Frequently asked questions

Why do "yes", "no", "on", and "off" stay strings instead of becoming booleans?

Our parser runs js-yaml implementing YAML 1.2 Core Schema rules, where only true and false are booleans and yes/no/on/off are treated as plain strings.

Do YAML anchors (&) and aliases (*) work?

Yes, acyclic *alias references resolve into their anchored values cleanly. Cyclic self-referencing aliases (*loop) cannot be serialized to JSON and return a controlled error.

Can multiple YAML documents separated by "---" be converted together?

No. The converter requires a single YAML document per conversion and rejects multi-document streams with an explicit error.

Are YAML comments or formatting preserved?

No. Standard JSON has no comment syntax or formatting metadata, so comments are stripped during parsing.

Related tools and contextual links

View all 16 tools →
Convert JSON into YAML →

Serialize converted JSON back into 2-space YAML with safe scalar quoting.

Inspect the converted data tree →

Explore converted objects and arrays visually in a collapsible tree.

Validate the converted JSON against a schema →

Test converted configuration payloads against Draft-07, 2019-09, or 2020-12 schemas.