YAML to JSON Converter Online

Convert YAML to JSON and back instantly in your browser. Your data stays on your device.

Your YAML and JSON are converted locally in your browser and nothing is uploaded to a server.

Built and maintained by Udit Agarwal

Need to tidy up the result? Try the JSON Formatter.

About YAML ↔ JSON

This yaml to json converter turns YAML into clean, formatted JSON and converts JSON back into YAML with a single direction toggle. Paste a config file, Kubernetes manifest, CI pipeline, or API response and switch instantly to convert yaml to json or json to yaml. The JSON output is syntax highlighted and pretty-printed, ready to copy or download as a .json or .yaml file. It is built for developers, DevOps engineers, and QA testers who hop between the two formats while editing configs or debugging payloads. Conversion uses a standard YAML parser, so anchors and typed scalars are resolved correctly. Everything runs locally in your browser, so your data never leaves your device.

Features

  • Converts YAML to JSON and JSON to YAML with a single direction toggle
  • Live conversion that updates as you type, with no run button
  • Pretty-prints JSON output with two-space indentation
  • Syntax-highlighted JSON output for easier scanning
  • Copy the result to your clipboard in one click
  • Downloads output as a data.json or data.yaml file
  • Inline error messages pinpoint invalid YAML or JSON input
  • Resolves YAML anchors and typed scalars via a standard parser

How to use the YAML ↔ JSON

  1. Pick a direction with the YAML to JSON or JSON to YAML toggle at the top.
  2. Paste or type your source into the input box on the left.
  3. Read the converted output as it appears live on the right.
  4. Click the copy button or download the result as a .json or .yaml file.
  5. Press Clear to reset the input and start a new conversion.

Example

Input

name: ArrayKit
offline: true
tags:
  - dev
  - tools

Output

{
  "name": "ArrayKit",
  "offline": true,
  "tags": [
    "dev",
    "tools"
  ]
}

YAML to JSON conversion of a small config block.

Common errors & troubleshooting

  • Pasting multiple YAML documents separated by ---. — Only a single document is converted; if several are present the first one is used. Split the documents and convert them one at a time.
  • YAML comments disappear after conversion. — Comments are dropped because JSON has no comment syntax. Keep an original copy of the YAML if you need to retain the comments.
  • Invalid JSON error when converting to YAML. — Check for trailing commas, single quotes, or unquoted keys; the input must be strict, valid JSON before it can become YAML.
  • Tabs in YAML cause a parse error. — YAML does not allow tabs for indentation. Replace tab characters with spaces and convert again.

Frequently asked questions

What is a YAML to JSON converter?
It is a tool that parses YAML and re-serializes it as equivalent JSON. This converter also runs in reverse, turning JSON back into YAML, so you can move between the two formats in one place.
How do I convert JSON back to YAML with this tool?
Set the direction toggle to JSON to YAML, then paste your JSON into the input box. The YAML output updates live and can be copied or downloaded as a .yaml file.
Does this yaml to json converter support multi-document YAML?
It converts a single document. If your input contains several documents separated by ---, only the first one is used in the output.
Are YAML comments preserved in the JSON output?
No. YAML comments are dropped during conversion because JSON does not support comments. Keep the original YAML if you need them.
What indentation does the JSON output use?
JSON is pretty-printed with two-space indentation so it stays readable and diff-friendly in version control.
Is my YAML or JSON data uploaded anywhere when I use this converter?
No. The conversion runs entirely in your browser, so your YAML and JSON never leave your device and nothing is uploaded to a server.

Related tools

  • JSON Formatter — Beautify, minify and validate JSON with error locations.
  • XML Formatter — Beautify, minify and validate XML, and convert XML ↔ JSON.
  • JSON to CSV — Convert an array of flat JSON objects to CSV.
  • JSON to Code — Generate Go, Rust, Python, Java, Kotlin, C# and TypeScript types from JSON.
  • JSON Viewer — Text + collapsible tree viewer with expand/collapse and node paths.
  • JSON Tree Viewer — Explore JSON as a collapsible, typed tree.
  • Markdown Preview — Render Markdown to HTML with a live preview.

Guides

More Code Formatters tools

  • Markdown Preview — Render Markdown to HTML with a live preview.
  • Regex Tester — Test regular expressions live with matches, groups and flags.
  • CSS Color Converter — Convert between HEX, RGB and HSL with a live swatch.
  • Text Diff — Compare two texts line-by-line and see additions and removals.
  • MDX Converter — Render MDX as formatted text, convert HTML → MDX, and escape text to literal MDX.
  • CSS / SCSS Formatter — Beautify or minify CSS/SCSS/LESS, sort properties and remove duplicates.
  • JS / TS Formatter — Beautify JavaScript, TypeScript and JSX/TSX with Prettier options, or minify plain JavaScript.
  • HTML Formatter — Beautify or minify HTML, format inline CSS/JS, and preview the result.
  • XML Formatter — Beautify, minify and validate XML, and convert XML ↔ JSON.
  • SQL Formatter — Format SQL for MySQL, PostgreSQL, SQL Server, SQLite, BigQuery and Oracle.
  • GraphQL Formatter — Format or minify GraphQL queries and schemas, validate syntax and extract operations.
  • Dockerfile Formatter — Format a Dockerfile and get best-practice / lint suggestions.

See all Code Formatters tools (32) · All tools