P
Privatool

YAML to JSON Converter Online Free — Convert YAML ↔ JSON

Convert YAML to JSON and JSON to YAML instantly in your browser. Handles nested objects, arrays, all scalar types, multi-line strings, anchors, and aliases. Syntax highlighting for both formats, precise parse errors with line numbers, sort keys option, and configurable indent. Use the swap button to convert in the opposite direction. Powered by js-yaml — no data uploaded.

Loading YAML ↔ JSON Converter…

How to Convert YAML to JSON Online Free

  1. 01

    Paste or upload

    Paste YAML or JSON directly, click Upload to open a file, or load a sample to try the tool instantly.

  2. 02

    Set options

    Choose indent size (2 or 4 spaces), toggle key sorting, and for JSON→YAML set line width and quote style.

  3. 03

    Copy or download

    The result appears with syntax highlighting. Copy to clipboard or download as .json or .yaml. Use the swap button to chain conversions.

Features

  • Two-way conversion: YAML → JSON and JSON → YAML
  • Syntax highlighting for keys, strings, numbers, booleans
  • Clear parse errors with line number and description
  • Sort keys alphabetically in output
  • Indent: 2 or 4 spaces; minify option for JSON output
  • Line width control and quote style for YAML output
  • Swap button to convert output back as new input
  • 100% client-side — data never leaves your browser

YAML vs JSON — Key Differences

FeatureYAMLJSON
Comments✓ Supported (#)✗ Not supported
Multiline strings✓ Block scalars (|, >)✗ Escaped \n only
References✓ Anchors & aliases (&, *)✗ Not supported
VerbosityMinimal (no brackets)More verbose (braces, quotes)
Data typesInferred automaticallyExplicit strings/numbers
Common useConfig files (k8s, CI/CD)APIs, data exchange

Frequently Asked Questions

How do I convert YAML to JSON?
Paste your YAML into the left panel with the "YAML → JSON" direction selected. The converter uses the js-yaml library to parse your YAML and outputs formatted JSON on the right. If your YAML contains a parse error, the exact line number and error description are shown.
How do I convert JSON to YAML?
Click the "JSON → YAML" tab (or the swap arrow) and paste your JSON into the input panel. The converter parses the JSON and renders it as clean YAML with proper indentation. Block style is used by default for readability.
What YAML features are supported?
The converter supports all standard YAML 1.2 features: nested objects and arrays, strings, numbers, booleans, null values, multi-line strings (literal and folded block scalars), anchors and aliases, and comments (preserved in display, removed in JSON output since JSON has no comment syntax).
What does the "Sort keys" option do?
When Sort keys is enabled, all object keys are sorted alphabetically in the output. This is useful for diffing configuration files or ensuring deterministic output when comparing YAML/JSON from different sources.
Why does my YAML boolean convert to true/false in JSON?
YAML treats yes/no, on/off, and true/false as boolean values. When converting to JSON, they become the JSON boolean true or false. If you need "yes" to remain a string in the JSON output, quote it in your YAML: "yes" (with quotes).
Is my YAML or JSON data sent to a server?
No. All conversion is done entirely in your browser using the js-yaml library loaded locally. Your data is never uploaded to any server and is never stored or logged. The tool works completely offline once the page is loaded.

Related Tools