YAML Validator

Validate YAML syntax and preview the parsed JSON — all in your browser

YAML Input

Paste or type YAML to validate

Result

Validation status & JSON

Valid YAML
{
  "name": "devtools",
  "version": 1,
  "features": [
    "yaml",
    "json"
  ],
  "nested": {
    "enabled": true,
    "count": 3
  }
}

Examples

Validate a mapping with a sequence

Input
name: devtools
features:
  - yaml
  - json
enabled: true
Output
{
  "name": "devtools",
  "features": [
    "yaml",
    "json"
  ],
  "enabled": true
}

js-yaml loads the mapping successfully, and the tool displays the result as indented JSON.

Reject a tab used for indentation

Input
name: devtools
features:
	- yaml
Output
Line 3: tab characters must not be used in indentation (3:1)

 1 | name: devtools
 2 | features:
 3 | →- yaml
-----^

The component adds Line 3 before the exact marked js-yaml parser message.

Inspect scalar resolution

Input
answer: yes
missing: null
count: 3
Output
{
  "answer": "yes",
  "missing": null,
  "count": 3
}

Under js-yaml's default schema, yes remains a string, null resolves to null, and 3 resolves to a number.

About this tool

YAML Validator parses the input with js-yaml's load function. Non-empty input that parses successfully is marked Valid YAML and displayed as two-space, pretty-printed JSON, making the resolved mappings, sequences, scalar types, and null values visible rather than only confirming syntax.

Invalid input is caught and displayed with js-yaml's parser message. When the error includes a source mark, the interface adds its one-based line number; the message can also include a source excerpt and caret. Empty or whitespace-only input is handled separately as Empty input.

Validation updates as the YAML changes, and the built-in sample can be restored at any time. A successful JSON preview can be copied directly. The component uses the default js-yaml load schema and parses one YAML document rather than accepting a multi-document stream.

How to use

  1. Paste or type YAML

    Enter one YAML document in the input pane, or load the built-in mapping-and-sequence example.

  2. Read the validation status

    A successful parse shows Valid YAML. A failure shows the js-yaml message and, when available, the marked one-based line number.

  3. Inspect resolved values as JSON

    Use the JSON preview to verify whether scalars became strings, numbers, booleans, or null and whether mappings and sequences have the expected shape.

  4. Correct or copy

    Fix indentation or syntax until parsing succeeds, then copy the pretty-printed JSON when a downstream task needs the parsed representation.

Use cases

Checking configuration syntax

Validate a YAML configuration snippet before adding it to an application, deployment, or automation repository.

Diagnosing indentation errors

Use the marked parser line and source excerpt to locate tabs, malformed collections, or inconsistent nesting.

Confirming scalar types

Inspect the parsed JSON to see whether a value resolves as a string, number, boolean, or null.

Converting one parsed document for debugging

Copy the JSON preview when a debugger, issue report, or test fixture is easier to work with in JSON form.

Common mistakes

Mistake:Using tabs for YAML indentation.

Fix:Indent nested YAML with spaces only. js-yaml rejects tab characters used for indentation and reports the marked line.

Mistake:Changing indentation width within one nested structure.

Fix:Use a consistent number of spaces at each level and align sibling mapping keys or sequence items at the same column.

Mistake:Leaving yes, no, or null unquoted when the value must be literal text.

Fix:Quote ambiguous strings for clarity and portability. This validator keeps yes and no as strings under its default schema, but null resolves to null and YAML 1.1 consumers may coerce yes/no differently.

Mistake:Repeating a mapping key and assuming the later value will silently win.

Fix:Keep mapping keys unique. js-yaml's load function rejects duplicate mapping keys instead of returning an apparently valid preview.

Frequently asked questions

References & standards