Skip to content
uencoder
TASK

Convert JSON to YAML and back without losing data

Translate between JSON and YAML for config files, preserving nested structures, arrays, and scalar types across the round-trip.

  1. 1

    YAML is a superset of JSON with indentation-based structure and fewer brackets — preferred for human-edited config. Converting JSON→YAML makes config readable; YAML→JSON makes it machine-parseable. The conversion must preserve types, nesting, and arrays.

  2. 2
    JSON YAML Converter →

    Paste JSON. The tool outputs equivalent YAML with 2-space indentation, block style for maps and sequences, and proper quoting only where needed.

  3. 3
    json-format → json-yaml

    Use the chain to convert JSON→YAML and immediately validate the YAML parses back to the same structure.

  4. 4

    Reverse direction: paste YAML, get JSON. Useful when a tool expects JSON input but your source is a YAML config.

  5. 5

    Watch for YAML-specific gotchas: unquoted strings that look like booleans (yes/no/on/off), numbers with leading zeros (interpreted as octal in YAML 1.1), and multi-line string folding. Quote ambiguous scalars to be safe.

Frequently asked questions

Why does my YAML have quotes around some strings but not others?
YAML quotes strings that would otherwise be misinterpreted — e.g. 'true' (would be boolean), '123' (would be number), strings with special characters. The converter adds quotes only where necessary to preserve the JSON type.
Can all JSON be converted to YAML?
Yes — YAML is a superset of JSON, so every valid JSON document is also valid YAML. The reverse is not true: YAML features like anchors, multi-document streams, and tags have no JSON equivalent and may be lost or rejected.

Workflows that solve this

Compare two YAML configs via JSON
Convert YAML configs to JSON for diff-friendly comparison of structured values.
PIPELINE
Convert CSV to JSON then YAML
Transform spreadsheet CSV data into YAML via a JSON intermediate, suitable for config generation.
PIPELINE
Encode a JSON payload for URL transport
Prepare a JSON document for a URL parameter: pretty-print, Base64-encode, then percent-encode — the exact inverse of the nested-parameter decode chain.
PIPELINE
ENV to JSON to YAML
Convert .env to JSON then to YAML for deployment configs.
PIPELINE
HJSON to JSON Format
Format HJSON then convert to standard JSON.
PIPELINE
INI to JSON to YAML
Convert INI to JSON then to YAML for modern config format.
PIPELINE
Format JSON and compute integrity checksum
Pretty-print a JSON document and compute a CRC32 checksum to detect any subsequent modifications.
PIPELINE
Minify and validate JSON
Format JSON for inspection and validate it is syntactically correct in one pass.
PIPELINE
Format JSON and generate TypeScript interface
Format a JSON document then infer a TypeScript interface definition in one chain.
PIPELINE
Validate, format, then convert JSON to YAML
Convert a (possibly minified) JSON config to YAML, catching syntax errors at the first node instead of producing subtly wrong YAML.
PIPELINE
Convert JSON to YAML then TOML
Migrate a JSON configuration through YAML into TOML for Rust or Python project configs.
PIPELINE
JSON5 to JSON Format
Format JSON5 then convert to standard JSON.
PIPELINE
JSONC to JSON Format
Format JSONC (JSON with comments) then convert to standard JSON.
PIPELINE
Decode and format a JWT payload
Parse a JWT token, extract its payload, and format the JSON for inspection.
PIPELINE
Properties to JSON to YAML
Convert Java properties to JSON then to YAML.
PIPELINE
Parse Query String and Format JSON
Parse query string into key-value pairs then format as JSON.
PIPELINE
Convert TOML to JSON
Parse a TOML configuration file into JSON for tools and APIs that expect JSON input.
PIPELINE
Convert TOML to JSON then YAML
Transform a TOML config into YAML via JSON for Kubernetes or CI tooling.
PIPELINE
Convert TOML to YAML via JSON
Transform a TOML configuration file into YAML format, using JSON as an intermediate representation.
PIPELINE
Decode nested URL parameter (Base64 JSON)
Unwrap a URL parameter that carries URL-encoded Base64 JSON into readable, formatted JSON.
PIPELINE
Convert YAML to JSON
Turn a YAML document into JSON and inspect the parsed values for type coercion surprises.
PIPELINE
YAML to JSON to CSV
Convert YAML to JSON then to CSV for spreadsheet use.
PIPELINE
Generate TypeScript interfaces from YAML
Convert a YAML document to TypeScript interface definitions, using JSON as an intermediate format.
PIPELINE
Validate and format YAML
Convert YAML to JSON to validate its structure, then confirm the JSON is well-formed.
PIPELINE

Learn more

Want to understand why?

Related tools