Language
English English Vietnamese (Tiếng Việt) Vietnamese (Tiếng Việt) Chinese (简体中文) Chinese (简体中文) Portuguese (Brazil) (Português do Brasil) Portuguese (Brazil) (Português do Brasil) Spanish (Español) Spanish (Español) Indonesian (Bahasa Indonesia) Indonesian (Bahasa Indonesia)
YAML to JSON Converter

YAML to JSON Converter

Convert YAML to JSON instantly with real-time preview, syntax highlighting, indent and sort-keys options, and a collapsible tree view.

YAML to JSON Converter

This YAML to JSON converter turns YAML (YAML Ain't Markup Language) into clean JSON (JavaScript Object Notation) the moment you type or paste. The converted output appears instantly beside your input, with color-coded syntax highlighting and an interactive tree view to help you read the structure.

It is built for developers who need to move data between formats: feeding a YAML config into a JSON-only API, converting Docker Compose, Kubernetes, or CI/CD files for another tool, or simply inspecting nested data in a language that handles JSON more comfortably.

Private by design: every conversion runs entirely in your browser. Your YAML is never uploaded, stored, or sent to any server.

How to Use

1

Enter your YAML

Paste or type YAML into the left panel, or click Upload File to load a .yml or .yaml file. Press Sample Data to drop in an example Docker Compose configuration.

2

See JSON instantly

The converted JSON appears in the right panel as you type. Valid input shows a Valid status; a syntax error highlights the exact line and shows its line and column.

3

Format the output

Choose an Indent of 2, 4, or 8 spaces, or Min for compact minified JSON. Toggle Sort Keys to order every object key alphabetically.

4

Copy or download

Use Copy to send the JSON to your clipboard, or Download to save it as a .json file. Switch to Tree view first if you want to explore the structure.

Features

Real-Time Conversion

YAML is converted to JSON as you type, with pasted data converting immediately. No button to press.

Syntax Highlighting

JSON output is color-coded by type, with keys, strings, numbers, booleans, null, and brackets each styled distinctly.

Indent Options

Output with 2, 4, or 8 spaces for readability, or choose Min for compact minified JSON.

Sort Keys

Toggle alphabetical ordering of every object key in the output without touching your original YAML.

Interactive Tree View

Explore nested data in a collapsible tree where each node shows how many items it contains.

Line Numbers

The input editor shows line numbers that stay in sync as you scroll through larger documents.

Error Detection

Invalid YAML is flagged instantly, with the offending line highlighted and the exact line and column reported.

File Upload & Download

Load .yml or .yaml files from your device and save the converted result as a .json file.

Live Status Bar

A status bar tracks validity and shows the output's line count, key count, and byte size at a glance.

Dark Mode & Responsive

A built-in dark theme and a responsive layout keep the editor comfortable on any screen size.

Frequently Asked Questions

How do I convert YAML to JSON online?

Paste or type your YAML into the left panel, or upload a .yml / .yaml file. The JSON appears in the right panel instantly. Then pick an indent size, optionally sort the keys, and copy or download the result. There is nothing to install or sign up for.

What is the difference between YAML and JSON?

Both are data serialization formats for the same kinds of structures: objects, arrays, and scalar values. YAML uses indentation and is designed to be human-friendly for config files and supports comments. JSON uses braces and brackets, is more compact, and is the standard for APIs and JavaScript. In fact, valid JSON is also valid YAML, since YAML is a superset of JSON.

Can YAML be converted to JSON without losing data?

The data itself is preserved: strings stay strings, numbers become JSON numbers, booleans become true/false, and null stays null. The one thing JSON cannot represent is comments, so YAML comments (lines starting with #) are dropped during conversion. The structure and values are otherwise carried over exactly.

Which YAML features are supported?

Conversion is handled by the js-yaml library with full YAML 1.2 support: objects, arrays, nested structures, strings, numbers, booleans, null values, multi-line strings, and comments. Comments are stripped because JSON has no comment syntax. When multiple documents are separated by ---, the first document is converted, so split multi-document files and convert each part on its own.

Can I convert a Swagger or OpenAPI YAML file?

Yes. Swagger and OpenAPI specifications are ordinary YAML, so you can paste or upload the file and get the equivalent JSON spec. Use the indent options to format it for readability, or Min to produce a compact version for tooling that prefers minified JSON.

Does Sort Keys change my original YAML?

No. Sort Keys only reorders keys in the JSON output. Your YAML in the input panel stays exactly as you entered it. Toggle the option off to return to the original key order.

How large a file can I convert?

Because everything runs in your browser, the practical limit depends on your device's memory. The tool handles files up to several megabytes comfortably; very large documents may take a brief moment to convert.

Is my data kept private?

Yes. All conversion happens locally in your browser. Your YAML and the resulting JSON are never uploaded to a server, and nothing is collected or stored.

Indent:
YAML
JSON
Error

                

Paste YAML data on the left to convert

| |
Paste or type YAML on the left panel to see instant JSON output on the right
Use indent options (2, 4, 8, Min) to control JSON formatting
Click Sort Keys to alphabetically sort all object keys in the output
Switch to Tree view to explore the JSON structure with collapsible nodes
Press Tab in the editor to insert spaces
Click Sample Data to load an example Docker Compose configuration
Upload .yml or .yaml files directly for conversion
All processing happens in your browser - no data is sent to any server
Want to learn more? Read documentation →
1/9
Start typing to search...
Searching...
No results found
Try searching with different keywords