Swelıty
Tools for everyone

Free Online YAML ↔ JSON Converter

Convert YAML to JSON and JSON to YAML with error messages, anchors and merge keys, and a JSON tree preview.

YAML input

JSON result

16 lines · 208 characters

How to use

  1. Choose YAML to JSON or JSON to YAML, then paste your text or open a file.

  2. Adjust the options, such as indentation and sorting keys.

  3. Read the result, or switch to Tree to explore JSON as a collapsible outline.

  4. Copy the result or download it as a file.

  5. Use A− and A+ in the editor's title bar to change the text size, untick Wrap long lines under it to scroll sideways, and use the icons to copy, download or clear the text.

Why use this tool

  • Live conversion with clear errors

    Results update as you type, and mistakes show the line and column.

  • Anchors and merge keys

    Reusable blocks (&anchor and *alias) and merge keys (<<) are resolved, as used in docker-compose and CI files.

  • Tree preview

    Explore converted JSON as a collapsible tree before you copy it.

  • Both directions

    Switch direction in one click and carry your result across.

  • Code editor

    A real code editor with syntax colours, line numbers, undo and redo, adjustable text size and optional line wrapping.

About this tool

It resolves anchors and merge keys, handles files with several YAML documents, and shows clear errors with line and column numbers. Use the tree view to explore the converted data, set the indentation, sort keys, and copy or download the result.

Frequently asked questions

JSON has no comments, so they are dropped when converting YAML to JSON. Converting back will not restore them.

Yes. Documents separated by --- become an array of values in the JSON result, and the tool tells you when that happens.

YAML can hold values such as .inf and .nan that JSON cannot represent, so they are written as null to keep the JSON valid.

Numbers, true and false, null, lists and nested objects are preserved. YAML 1.2 treats unquoted dates as plain text, so they stay as strings.

YAML 1.2, with merge keys also supported because many tools rely on them.

Yes. Use A− and A+ in the editor's title bar to change the text size, and untick Wrap long lines under the editor to scroll sideways. Both choices are remembered on this device.