JSON ↔ YAML Converter

Convert JSON to YAML and back. Kubernetes-friendly, block or flow style, sort keys.

  • [FREE]
  • [NO_SIGNUP]
  • [NO_UPLOAD]

How to use the JSON ↔ YAML converter

  1. Pick a direction. JSON → YAML for converting API payloads to readable config. YAML → JSON for feeding YAML into systems that only speak JSON.
  2. Paste your input. The left pane accepts JSON (or JSONC, if you toggle the option) or YAML depending on direction. The right pane shows the converted output live.
  3. Choose block or flow. Block is the readable multi-line YAML. Flow is the compact inline form. Pick what your downstream tool expects.
  4. Set indent and sort. 2 or 4 spaces. Toggle Sort keys when diffing two configurations whose key order differs.
  5. Share or download. Copy share link round-trips the whole session via the URL hash. Download saves the result as data.yaml or data.json.

Why convert between JSON and YAML?

  • Kubernetes: most manifests are YAML on disk but kubectl accepts JSON.
  • GitHub Actions / GitLab CI: workflow files are YAML; intermediate scripts often produce JSON that needs converting.
  • OpenAPI / Swagger: spec files exist in both forms; tools and editors pick one.
  • VS Code / tsconfig: JSONC settings can be exported to YAML for documentation or audit.
  • Helm charts: values.yaml ↔ JSON when integrating with external systems.

YAML gotchas this tool guards against

Quoting strings that look like other types

YAML coerces unquoted scalars aggressively. The classic example: country: NO parses as country: false under YAML 1.1 (“Norway problem”). This tool uses the YAML 1.2 JSON-compatible schema and quotes ambiguous strings on JSON → YAML output, so "NO" stays a string when you round-trip back.

YAML inputParsed as
value: 1.0float 1
value: "1.0"string "1.0"
value: yes(YAML 1.1) boolean true
value: "yes"string "yes"
value: 007integer 7
value: "007"string "007"

Indentation

YAML uses spaces, not tabs. This tool emits spaces only. If you paste YAML with tabs, the parser will reject it with a clear line/column error.

Anchors and aliases

defaults: &defaults
  retries: 3
prod:
  <<: *defaults
  url: https://example.com

YAML → JSON expands anchors so the output JSON has the merged keys. JSON → YAML never emits anchors (every reference becomes a literal copy). This is the same behavior as kubectl apply and most CI systems.

Multi-document YAML

Files with --- separators (multiple documents in one file) are rejected. Split them and convert one at a time.

Example: Kubernetes Service

Input (JSON):

{
  "apiVersion": "v1",
  "kind": "Service",
  "metadata": { "name": "demo" },
  "spec": {
    "selector": { "app": "demo" },
    "ports": [{ "port": 80, "targetPort": 8080 }]
  }
}

Output (YAML, block style, 2-space indent):

apiVersion: v1
kind: Service
metadata:
  name: demo
spec:
  selector:
    app: demo
  ports:
    - port: 80
      targetPort: 8080

Round-tripping back to JSON returns the same object.

Privacy and security

The converter is a single HTML page with a small JavaScript bundle. Your input never leaves your device. The share link encodes state in the URL fragment (#…) — that part of a URL is not sent to servers. Verify in DevTools → Network: no outbound requests after the page loads.

Frequently asked questions

Is my data sent to a server?

No. Everything runs in your browser tab. Open DevTools → Network and you will see no outbound request with your input. The share link encodes state into the URL hash (#…), which the browser does not transmit to servers.

Which YAML version is supported?

YAML 1.2 via js-yaml. The parser uses the JSON-compatible schema for YAML → JSON conversion, which avoids surprises like the "Norway problem" where YAML 1.1 turned the unquoted value "no" into the boolean false. Strings that look like numbers or booleans are quoted on output to round-trip safely.

What is the difference between block and flow style?

Block style is multi-line YAML with indentation — what people usually mean by YAML. Flow style uses inline braces and brackets, which looks like JSON. Pick block for human-readable configs and flow for compact one-liners. "Mixed depth N" emits block down to N levels then switches to flow for deeper structures.

Why are some of my strings quoted when I did not quote them in JSON?

The converter quotes strings that would otherwise be parsed back as something else: numbers ("1.0"), booleans ("yes"/"no"/"true"/"false"), null markers ("null"/"~"), or anything starting with leading zeros ("007"). Without quoting, a YAML reader would silently coerce these to non-string values when converted back.

Does the tool keep my comments?

JSON has no comments, so JSON → YAML cannot add any. YAML → JSON drops comments because JSON does not support them. To convert JSONC (JSON with comments) to YAML, toggle the JSONC input checkbox — comments and trailing commas are stripped before conversion.

Can I convert a multi-document YAML file?

Not in this tool. Multi-document YAML (separated by ---) is rejected with a clear error. Convert one document at a time. This is a deliberate scope choice; almost all configuration use cases are single-doc.

What about anchors and aliases (& and *)?

The converter resolves anchors and aliases into expanded JSON on the YAML → JSON path. On the JSON → YAML path no anchors are emitted (noRefs is enabled). If you depend on anchors, keep them in your source-of-truth YAML and edit there.

Does it handle Kubernetes manifests?

Yes — that is the most common use case. The Load sample button drops in a small Deployment manifest you can convert to JSON and back to verify the round trip preserves structure.

Why does my number "1.0" become "1" after YAML → JSON?

Unquoted 1.0 in YAML is the floating-point number 1, which JSON.stringify writes as "1". To preserve the literal text, quote it in YAML: version: "1.0". Same trick for "007" or "01:30".

Is this YAML converter really free?

Yes. No signup, no account, no ads, no telemetry on your input. The source is on the project repository.