# YAML to JSON Converter - Convert YAML ↔ JSON Online with Error Locations

> Free online YAML and JSON converter: multi-document YAML, anchors, aliases and merge keys, errors with line and column, plus indent, sorting and folding.

- URL: https://qilingtools.com/en/yaml-json
- Category: Developer Tools (https://qilingtools.com/en/dev)
- Tags: [Converters](https://qilingtools.com/en/tags/convert), [Developer](https://qilingtools.com/en/tags/dev), [Data Formats](https://qilingtools.com/en/tags/data)
- Last updated: 2026-10-26
- Price: Free, no sign-up
- Privacy: Runs locally in the browser; files are never uploaded

Kubernetes manifests, docker-compose files, GitHub Actions workflows and Spring Boot configs are written in YAML, while APIs and code usually want JSON. Paste YAML to get formatted JSON, or paste JSON to get clean YAML. Parsing uses the mature yaml library with full YAML 1.2 support: multiple documents separated by --- (combined into a JSON array or emitted as JSON Lines), anchors & and aliases *, << merge keys, block scalars | and >, and every quoting style. Syntax errors point to the exact line and column with the offending line shown, and duplicate keys are reported too. When converting JSON to YAML you can choose the indent, sort keys, double-quote all strings, fold long strings at 80 columns and split a top-level array into separate YAML documents. Use result as input flips the direction in one click so you can verify a round trip.

## How to use

1. Choose YAML → JSON or JSON → YAML
2. Paste your content and set indent, sorting and multi-document options
3. Copy or download the result, or fix the error at the reported line and column

## Features

- Two-way YAML and JSON conversion
- Multi-document --- as a JSON array or JSON Lines
- Anchors, aliases and << merge keys
- Syntax errors and duplicate keys with line and column
- Indent, key sorting, quoting and line folding options
- Split a top-level JSON array into YAML documents
- One-click reverse conversion; nothing is uploaded

## FAQ

### How are anchors and << merge keys handled?

Content defined with an anchor &name is fully expanded wherever the alias *name appears. With merge keys enabled, the common docker-compose pattern <<: *common merges the shared mapping into the current one, with keys written locally taking precedence. The resulting JSON contains only expanded values.

### What happens with several YAML documents in one file?

Documents separated by --- are parsed one by one. By default they are combined into a JSON array with one element per document; choose JSON Lines to get one compact line per document, handy for Kubernetes manifests and streaming tools.

### Why do yes, on and dates stay as strings?

The converter follows the YAML 1.2 core schema: only true and false are booleans, while yes, no, on and off are plain strings, and dates stay strings because JSON has no date type. This matches modern tools such as Kubernetes and avoids the classic problem of NO turning into false.

### Is my data uploaded?

No. Conversion runs entirely in your browser, so passwords, tokens and other secrets in your config files never leave your computer and are discarded when you close the page.

## Related tools

- [JSON Formatter](https://qilingtools.com/en/json): Free online JSON formatter: beautify or minify, validate with the exact line and column of any error, browse a collapsible tree, sort keys and escape strings.
- [Base64 Encode/Decode](https://qilingtools.com/en/base64): Free online Base64 encoder and decoder: UTF-8 safe, optional URL-safe variant, convert text to Base64 and back in real time. Processed locally, never uploaded.
- [URL Encode/Decode](https://qilingtools.com/en/url-encode): Free online URL encoder and decoder with encodeURIComponent and encodeURI modes. Escapes Chinese, spaces and special characters. Real-time and local, no upload.
- [JWT Decoder](https://qilingtools.com/en/jwt): Free online JWT decoder: decode the header and payload of a JSON Web Token, show expiry and issued-at times, all locally without uploading the token.
- [Timestamp Converter](https://qilingtools.com/en/timestamp): Free online Unix timestamp converter: convert timestamps and dates, auto-detect seconds or milliseconds, and show local, UTC, ISO 8601 and relative time.
- [Hash / Checksum](https://qilingtools.com/en/hash): Free online hash calculator: SHA-1, SHA-256, SHA-384 and SHA-512 of text or any file through the browser crypto API. Files never leave your device.
- [UUID Generator](https://qilingtools.com/en/uuid): Free online UUID generator: create RFC 4122 UUID v4 in bulk with a cryptographic RNG. Options for uppercase, no hyphens and braces, with one-click copy.
- [Base Converter](https://qilingtools.com/en/base-convert): Free online number base converter: convert between binary, octal, decimal, hexadecimal and any base 2–36. Uses BigInt for huge integers, computed locally.
