JSON ⇄ YAML Converter
Convert config files between JSON and YAML in seconds. Handy for Kubernetes manifests, CI pipelines, and comparing API responses. Runs entirely in your browser.
How to use it
- Paste data, open a local file, or load the JSON example.
- Select JSON → YAML for strict JSON input, or YAML → JSON for supported YAML input.
- Review the result, especially quoted strings and values that resemble booleans or numbers.
- Copy or download the converted document.
JSON to YAML example
{
"service": "users",
"replicas": 2,
"enabled": true,
"ports": [8080, 8081]
}
The converter produces a mapping with a nested list:
service: users
replicas: 2
enabled: true
ports:
- 8080
- 8081
Objects become YAML mappings, arrays become lists, and JSON strings, numbers, booleans, and null values become basic YAML scalars. Strings that could be mistaken for another type are quoted to preserve their meaning.
YAML to JSON example
Converting the YAML above back to JSON creates an object with the same supported data values. JSON output uses two-space indentation, which makes it ready for review in JSON Validator or use as an API fixture.
YAML comments are not data and JSON has no equivalent comment syntax, so comments are removed during conversion. Key order is normally preserved by the browser, but applications should not rely on object order as part of a contract.
Supported YAML subset
The local parser handles indentation-based mappings, lists, nested combinations, quoted and unquoted strings, integers, decimal numbers, booleans, null, empty objects, and empty arrays. It is designed for straightforward configuration and API examples rather than the complete YAML language.
Anchors and aliases, custom tags, block scalars, flow-style collections, merge keys, directives, and multiple documents are not supported. If a production configuration uses those features, process it with the same full YAML library used by the target system. This avoids accepting a simplified interpretation that differs from deployment behavior.
Common conversion problems
- Bad indentation: use spaces consistently and align siblings at the same level.
- Tabs in YAML: replace indentation tabs with spaces before conversion.
- Unexpected JSON token: JSON requires double-quoted keys and strings, no comments, and no trailing commas.
- String changed type: quote values such as
"true","null", or"0012"when they must remain strings. - Advanced feature not represented: use a complete YAML parser for anchors, block scalars, tags, or multi-document files.
When to convert JSON and YAML
Conversion is useful for moving API examples into configuration files, translating CI settings into JSON fixtures, reviewing Kubernetes-style data as strict JSON, and preparing an OpenAPI document for browser tools. Cryonel reads and converts the document in the current browser tab; input is not uploaded to a server.
Frequently Asked Questions
Which YAML features are supported?
Standard mapping/list structures and basic scalar types (string, number, boolean, null) are supported. Advanced YAML features like anchors/aliases (&/*), multi-document (---), and flow style ({a: 1}) are not currently supported.
Why does indentation matter?
Unlike JSON, YAML expresses hierarchy through whitespace indentation instead of braces. Use spaces (not tabs) and stick to a consistent 2-space indent.
Are YAML comments preserved in JSON?
No. JSON has no comment syntax, so YAML comments are not represented in the converted data and cannot be restored when converting back to YAML.