Guides/Tool Guides

YAML ↔ JSON Guide

Convert YAML and JSON.

Overview

Convert YAML ↔ JSON for config files and debugging (Kubernetes, CI/CD pipelines, app configs). Useful when one tool expects JSON while your source is YAML. Runs locally in your browser.

Pro time-savers

  • YAML multi-doc (---) convert

Use cases

  • Convert a Kubernetes YAML snippet to JSON for API calls or tooling.
  • Validate YAML indentation by converting to JSON and back.
  • Prepare a JSON version of a config for tests and fixtures.

Common pitfalls

  • Tabs in YAML often break parsing—use spaces.
  • Anchors/aliases may expand; the output might be semantically equivalent but not visually identical.

FAQs

Why does YAML parsing fail?

Indentation, tabs, or invalid list/object structure are common causes. Use spaces, and verify nested blocks carefully.

Are comments preserved?

No. Comments are lost when converting to JSON.

Will the output YAML look exactly the same?

Not necessarily. Formatting and ordering may change after conversion. The data should remain equivalent.

Is this safe for secrets?

Conversion runs locally by default. Still, avoid pasting secrets on shared machines or browsers you don’t trust.

Examples

Input

yaml=foo: 1
bar:
  - a
  - b

Output

{
  "foo": 1,
  "bar": [
    "a",
    "b"
  ]
}