/ /YAML Validator

YAML Validator

Validate YAML syntax and convert to JSON. Check for common YAML issues like inconsistent indentation, tabs, duplicate keys, and formatting errors.

Inputs

Character count: 0

Results

Input size:0 bytes

Related Tools

References

Frequently Asked Questions

What is YAML?
YAML (YAML Ain't Markup Language) is a human-readable data serialization format that uses indentation to represent structure. It is commonly used for configuration files, CI/CD pipelines, and data exchange.
Why is indentation important in YAML?
YAML uses indentation (spaces) to define nesting and structure. Inconsistent indentation causes parsing errors. Always use consistent spacing, typically 2 spaces per level.
Does YAML allow tabs?
No, YAML does not allow tabs for indentation. Only spaces are permitted. Using tabs will cause a parsing error. Configure your editor to convert tabs to spaces when editing YAML files.
What are YAML anchors and aliases?
Anchors (&) mark a node for reuse, and aliases (*) reference it later. For example: defaults: &defaults [key: value] and later: config: <<: *defaults merges the anchored values.
How do I write multi-line strings in YAML?
Use literal block scalar (|) to preserve newlines, or folded block scalar (>) to fold lines into spaces. For example: text: | preserves\nnewlines\n vs text: > folds into one line.
What is the difference between YAML and JSON?
YAML is more human-readable with minimal syntax (no braces, brackets, or quotes required). JSON is more widely supported in programming languages and is stricter. YAML is a superset of JSON.
How is YAML used in CI/CD pipelines?
CI/CD platforms like GitHub Actions, GitLab CI, Travis CI, and CircleCI use YAML files to define build, test, and deployment workflows with steps, jobs, triggers, and environment variables.
What is Kubernetes YAML?
Kubernetes uses YAML files to define resource configurations like Pods, Deployments, Services, and ConfigMaps. Each file has apiVersion, kind, metadata, and spec fields.
How is YAML used in Ansible?
Ansible uses YAML for playbooks that define automation tasks. Playbooks contain plays, hosts, tasks, modules, and variables written in YAML format with consistent indentation.
What are duplicate keys in YAML?
Duplicate keys occur when the same key appears multiple times at the same level. Most parsers will use the last value, but this often indicates a mistake. Validators should flag duplicate keys.
What data types does YAML support?
YAML supports scalars (strings, numbers, booleans, null), sequences (arrays/lists with -), mappings (dictionaries with key: value), and timestamps. Strings can be quoted or unquoted.
How do I comment in YAML?
Comments start with # and continue to the end of the line. They can be inline or on their own line. YAML has no block comment syntax, so each line must start with #.
Can YAML handle multiple documents in one file?
Yes, separate multiple YAML documents with --- (three dashes) on its own line. Use ... to explicitly end a document. This is common in Kubernetes manifest files.
What is the YAML 1.1 vs 1.2 difference?
YAML 1.2 is the current specification. Key differences include making JSON a strict subset, changing how booleans and numbers are interpreted, and removing some deprecated language features.