Skip to content
Esc

YAML to JSON

Convert YAML to JSON and JSON to YAML.

Try

About this tool

Runs in
your browser
Your input sent to our servers
Nothing
Kept on this device
nothing

More in the privacy policy.

How to use it

  1. 01Choose YAML → JSON or JSON → YAML, then paste your text, open a file or drop one on the page (a .json file converts to YAML, a .yaml or .yml file to JSON). Or pick one under Try.
  2. 02The result appears as you type; an error names its line and column. Choose YAML 1.1 for Ansible and older Kubernetes files, and the indent you want.
  3. 03Copy the result or download it as a file, or press Swap to convert it back.

Related tools

Questions

Why did yes become a string, or true?

In YAML 1.2, the current version, only true and false are booleans, so enabled: yes gives { "enabled": "yes" }. YAML 1.1, which Ansible and many older tools still read, also takes yes, no, on and off as booleans: { "enabled": true }. Choose the version your tool reads. Going to YAML, text like "yes" is quoted (enabled: "yes") so either kind of reader keeps it as text.

What happens to several documents, anchors and comments?

A file with several documents separated by --- becomes a JSON array, one item per document. Anchors and aliases (&name, *name) are copied in full where they are used. Comments aren’t part of the data, so they don’t survive the conversion.

Are big numbers kept exactly?

Yes, whole numbers of any size: id: 12345678901234567890 stays "id": 12345678901234567890, where many converters round it. Decimals are read as ordinary floating-point numbers.

What about tags like !Ref?

Tags this page doesn’t know, such as CloudFormation’s !Ref or !Sub, are listed above the result and their values are kept as plain text. Built-in tags like !!str and !!int work as YAML defines them.

Is my file sent anywhere?

No. It’s converted in your browser as you type, and a file you open is read there too. It isn’t sent to our servers, put into the page address or saved.