Skip to content
Data helper

JSON ⇔ YAML Converter

Convert JSON and YAML in both directions by simply pasting your data.
Switch between JSON to YAML and YAML to JSON instantly and view formatted results in real time.

This tool provides immediate feedback when formatting errors occur, helping you quickly identify syntax issues in configuration files or API payloads.
Converted results can be copied with a single click, making it easy to reuse them
in development, deployment, or documentation workflows.

All conversions are performed directly in your browser.
No input data is sent to any server, ensuring a fast and secure experience
for developers working with configuration files and structured data.

Errors show the exact line and column. You can sort keys, choose the JSON indent, accept loose JSON, convert multi-document YAML (---) to an array, and get a warning for strings such as yes / no / on / off that YAML 1.1 parsers misread.

Formatted results will appear here.

Export as .env or .properties

Flattens nested keys into environment variables (APP_DB_HOST=…) or Java properties (app.db.host=…). Arrays use the index.

TOML ⇄ JSON / YAML

Convert between TOML (Cargo.toml, pyproject.toml and similar) and the JSON or YAML above. TOML has no null, and the top level must be a table, so JSON with null or a top-level array cannot be converted.

XML ⇄ JSON

Convert XML to JSON, or the JSON above to XML. Attributes become @name keys, text next to attributes or child elements becomes #text, and repeated elements become arrays. Comments are dropped; CDATA and entities are decoded.

Guide

How to use & features

  • Paste JSON on the left or YAML on the right, then click the corresponding convert button.
  • If parsing fails, the status message turns red and shows the error details.
  • Swap inputs or clear both panels to iterate quickly.
Samples

Sample input & output

Transform JSON to YAML

Input
{"service":"api","port":8080,"enabled":true}
Output
service: api
port: 8080
enabled: true
FAQ

FAQ

  • Can it convert in both directions?

    Yes. It converts JSON to YAML and YAML to JSON, and has a button to swap the two sides.
  • Are YAML comments kept after conversion?

    No. JSON has no comments, so they are lost when converting YAML to JSON, and converting that JSON back to YAML does not restore them.
  • What happens to YAML anchors (`&`) and aliases (`*`)?

    They are expanded. `*x` is replaced with the content it points to, so the same content appears in several places in the JSON.
  • Can I use YAML with several documents separated by `---`?

    No. Only a single document is supported, so YAML split by `---` gives an error. Convert the parts one at a time.
  • What happens to YAML dates such as `2024-01-02`?

    An unquoted date is read as a date and becomes a date-time string such as `"2024-01-02T00:00:00.000Z"` in JSON. To keep the original text, wrap it in quotes in the YAML, as `"2024-01-02"`.
  • What if a JSON string contains `\n` as literal characters?

    When the input cannot be read as JSON, it converts `\n`, `\r` and `\t` into line breaks and tabs and tries again. JSON pasted from logs while still escaped can often be used as is.
Use cases

Common use cases

  • Moving between Kubernetes, GitHub Actions and OpenAPI configs

    Turn YAML configuration into JSON to inspect it, or turn a JSON sample into YAML to paste.
  • Converting config file formats

    Turn `docker-compose.yml` or CI settings into a form for tools or APIs that expect JSON.
  • Showing an API response as YAML in docs

    Convert a JSON response to YAML to make it easier to read in a README or design doc.
  • Finding where a syntax error is

    Paste half-written JSON or YAML and an error is shown, so you can tell which format is broken.
Notes

Notes & limitations

  • YAML comments are lost

    JSON has no comments, so converting YAML to JSON removes them. Keep the original YAML if the comments matter.
  • The type of date and time values can change

    An unquoted date becomes a date-time string in JSON. Wrap it in quotes if you want to keep it as the original string.
  • Anchors are expanded and the output grows

    Parts shared by `&` and `*` repeat in JSON, so the size increases.
  • Mind multiple documents and large integers

    YAML split by `---` cannot be converted. Large integers that JavaScript cannot represent exactly are rounded.
About

About this tool

Bidirectional JSON ⇔ YAML Converter

Convert interchangeably and instantaneously between JSON (JavaScript Object Notation) and YAML (YAML Ain’t Markup Language), two standard serialization formats critical for configuration files.
Whether you are writing Kubernetes manifests, Docker Compose scripts, or GitHub Actions workflows, developers constantly run into scenarios like needing to stringify YAML or wanting to validate potentially indented-broken YAML constructs locally in the browser. This secure, stateless utility reliably handles those nuances in real-time.

Common use cases

  • Work with config files: Convert between JSON and YAML for Kubernetes, CI, Docker, and application settings.
  • Validate indentation-sensitive YAML: Catch formatting issues before committing configuration.
  • Prepare API examples: Convert JSON responses into YAML examples for documentation.

Format note

YAML supports features that JSON does not, including comments and some shorthand syntax. After converting YAML to JSON, review whether comments, anchors, or special values were intentionally omitted or normalized.

Articles for this tool

Recent Articles