YAML ⇄ JSON Converter
Paste YAML or JSON, choose a direction, and PocketSpry converts it instantly in your browser using a standards-based YAML 1.2 parser. YAML → JSON turns one document into pretty 2-space JSON; JSON → YAML turns valid JSON into readable YAML. Scalar types (strings, numbers, booleans, null) are preserved where both formats can represent them, and structures JSON cannot represent are rejected rather than silently changed. Your data is processed locally and not sent to PocketSpry’s AI service.
Convert YAML and JSON instantly
Paste your structured data, choose the direction, and PocketSpry converts it locally in your browser — no sign-up, no upload, and no waiting on a server.
YAML to JSON
A single YAML document becomes pretty-printed JSON with 2-space indentation. Any JSON-compatible top-level value works — an object, an array, or even a single string, number, boolean, or null.
JSON to YAML
Valid JSON becomes readable, block-style YAML with 2-space indentation. Object key order is preserved as written — keys are not sorted.
Preserve data types
Strings, numbers, booleans, and null stay correctly typed where both formats can represent them. A quoted string like "00123", "true", or "null" stays a string in both directions — it is never turned into a number, a boolean, or null.
YAML mapping keys
JSON object keys must be strings, so a YAML mapping is convertible only when every key is a string. Non-string keys (numbers, booleans, or complex keys) are rejected rather than silently turned into strings, and duplicate keys are rejected too.
Numbers that cannot be represented safely
JSON cannot represent NaN or Infinity, and JavaScript cannot hold every large integer exactly. YAML numbers that are non-finite, or integers outside the safe range, are rejected rather than silently corrupted or rounded.
Comments and formatting
JSON has no comments, so YAML comments cannot survive conversion to JSON. Original formatting — comments, quote style, block vs. flow style, and spacing — is not preserved; the converter keeps the data, not the source layout, so a YAML → JSON → YAML round trip is not byte-for-byte identical.
Anchors and aliases
YAML anchors and aliases are expanded into ordinary repeated values, under a finite safety limit that blocks alias-expansion bombs. JSON has no anchor or alias syntax, so that identity is not preserved, and circular references are rejected because JSON cannot represent them.
One YAML document
YAML → JSON converts a single document. Multi-document YAML (files separated by ---) is intentionally rejected rather than silently turned into an array of documents.
YAML 1.2, standards-based
The converter uses a standards-based YAML 1.2 parser under a conservative core schema — not heuristic line-splitting — and does not execute custom tags or arbitrary code.
Private and browser-local
Your YAML and JSON are processed locally in your browser. They are not sent to PocketSpry’s AI service, and neither your data nor the converted result is sent to analytics.
Frequently asked questions
- What does YAML ⇄ JSON Converter do?
- It converts a single YAML document to JSON, or JSON to YAML, in your browser.
- Does it convert YAML to JSON?
- Yes.
- Does it convert JSON to YAML?
- Yes.
- Does it support .yml content?
- Yes — .yaml and .yml use the same YAML syntax.
- Which YAML version does it use?
- YAML 1.2 under a conservative core schema.
- Can I convert multiple YAML documents at once?
- No — one document at a time in this version.
- Does it preserve YAML comments?
- No — JSON has no comments, so they are dropped.
- Does it preserve YAML formatting exactly?
- No — it preserves the data, not the source layout.
- Does it preserve value types?
- Yes, for the supported JSON-compatible data model.
- What happens to a quoted YAML string such as "00123"?
- It stays a string.
- Are duplicate YAML keys allowed?
- No — they are rejected.
- Can YAML mapping keys be numbers or arrays?
- No — JSON object keys must be strings, so non-string keys are rejected.
- What happens to NaN or Infinity?
- They are rejected, since standard JSON cannot represent them.
- What about very large YAML integers?
- Integers outside JavaScript’s safe range are rejected rather than silently rounded.
- Does it support YAML anchors and aliases?
- Yes — they are expanded into repeated values under a finite safety limit.
- Are YAML anchors preserved in JSON?
- No — JSON has no anchor or alias syntax.
- Can circular aliases be converted?
- No — a circular reference cannot be represented in JSON.
- What happens to a JSON string "true"?
- It stays a string in the generated YAML.
- Does JSON → YAML sort my keys?
- No — key order is preserved.
- Does generated YAML use two-space indentation?
- Yes.
- Does generated YAML end with a newline?
- Yes — one final newline.
- Can I paste an array as the top-level value?
- Yes.
- Can I convert a top-level primitive?
- Yes — a string, number, boolean, or null.
- Does it execute YAML tags or code?
- No — custom tags are rejected and nothing is executed.
- Does my data leave my browser?
- No.
- Is the conversion sent to AI?
- No. This tool does not use AI and makes no server or AI call.
- Does PocketSpry send my data to Plausible?
- No. Your data and the converted result are not sent to analytics.
- What is the maximum input size?
- 200,000 characters.
- Is the result AI generated?
- No. It is computed deterministically in your browser.