YAML to JSON Converter & JSON to YAML Online
Convert a YAML document to JSON or JSON to readable YAML. Values are typed by YAML 1.2 rules, large integers stay exact and unsupported features are reported instead of guessed. Everything runs locally in your browser.
Your text never leaves your browser.
JSON output
Paste a YAML document or open a .yaml, .yml or .txt file to convert it to JSON.
Conversion options
Object keys keep their original order; nothing is sorted. YAML comments and formatting are not carried into JSON.
How to convert YAML to JSON
Keep the default YAML → JSON mode, then paste your YAML, open a local .yaml, .yml or .txt file, or load the sample. The document is parsed as YAML 1.2 and converted as you type. Choose 2-space, 4-space or compact JSON, then copy the result or download it as a .json file. Keys stay in the order they were written.
name: Ana active: true tags: - alpha - beta
{
"name": "Ana",
"active": true,
"tags": [
"alpha",
"beta"
]
}How to convert JSON to YAML
Switch to JSON → YAML and paste strict JSON: comments, trailing commas, single quotes and duplicate keys are reported as errors. The output uses 2 or 4 spaces of indentation. Strings that YAML could read as another type, such as "true", "0012", "null" or "yes", are quoted so they stay strings. Every result is parsed again before it is shown to check that it describes the same data as your JSON.
{"user":"Ana","active":true,"code":"0012","roles":["admin","editor"]}user: Ana active: true code: "0012" roles: - admin - editor
Use as input sends the result back to the input with the opposite direction selected, which is a quick way to confirm a round trip.
YAML 1.2 versus YAML 1.1 typing
The meaning of an unquoted value depends on the YAML version. YAML 1.1 read yes, no, on and off as booleans, 010 as an octal number and 2026-05-11 as a timestamp. YAML 1.2, used here, only recognises true, false, null and numbers (including decimal 010, which becomes 10). The words yes, no, on and off stay strings, and dates are never turned into time values. Some tools still parse YAML 1.1 rules, so quote anything that must be a string in every parser.
answer: yes enabled: true code: "0012" released: 2026-05-11
{
"answer": "yes",
"enabled": true,
"code": "0012",
"released": "2026-05-11"
}Arrays, objects and nested configuration
A YAML mapping becomes a JSON object and a sequence becomes an array, up to 256 levels deep. Block style (indentation and dashes) and flow style ({ a: 1 }, [1, 2]) produce the same JSON. Literal (|) and folded (>) block scalars become ordinary strings with their line breaks written as \n. Unicode text, accented letters, combining marks and emoji are kept unchanged. JSON object keys must be strings, so YAML keys that are numbers, booleans, null or whole collections are reported instead of being converted silently.
Comments, anchors, aliases and multi-document input
JSON has no comments, so YAML comments and formatting are not retained. Anchors (&name) and aliases (*name) are expanded into copies of the referenced value, within limits that protect your browser from documents designed to expand exponentially. Self-referencing structures are rejected. Merge keys (<<) belong to YAML 1.1 and are reported rather than merged. A file with several documents separated by --- is rejected, because JSON can hold only one top-level value. Custom tags such as !Ref are never evaluated; they are reported as unsupported.
Why JSON numbers sometimes cannot be represented safely
JavaScript stores numbers as 64-bit floating-point values, so integers above 2^53 − 1 (9,007,199,254,740,991) and decimals with more than about 17 significant digits are rounded by JSON.parse without warning. This converter reads numbers from the source text instead: integers of any size are written out digit for digit, and a decimal that would lose precision is rejected with a clear message. The value is preserved, but the spelling may change, for example 1.50 becomes 1.5 and 0x1F becomes 31; negative zero becomes 0. Other applications using ordinary JavaScript number parsing may still round large integers in the output. If an identifier must keep its exact form across applications, store it as a quoted string.
Kubernetes, CI/CD, API and other developer files
YAML is the usual format for Kubernetes manifests, Helm values, GitHub Actions and GitLab CI pipelines, Docker Compose files and OpenAPI specifications, while many APIs, SDKs and validators expect JSON. Convert a manifest to JSON to feed it to kubectl or the JSON Schema Validator, or turn an API payload into YAML for a configuration file. Files that use tool-specific tags, such as CloudFormation's !Ref, or several documents in one file need to be split or simplified first.
After converting, pretty-print or inspect JSON with the JSON Formatter & Validator, turn arrays of records into line-delimited data with the JSONL Converter, or move between tables and JSON with the JSON to CSV and CSV to JSON converters.
Privacy and local processing
Conversion runs in your browser. Pasted text and opened files are not uploaded, logged, sent to analytics or stored. Files are decoded as strict UTF-8 and invalid byte sequences are rejected. Supported sizes are up to 1,000,000 UTF-16 code units of pasted input, 1 MiB files and 5,000,000 code units of output. Larger inputs are refused with a message, never truncated. Nesting, alias expansion and YAML formatting work are also bounded; deeply nested data may need to be split even within these size limits. No partial output is shown when conversion fails.
Frequently asked questions
Why is "yes" a string and not true?
This converter follows the YAML 1.2 Core schema, where true, True, TRUE, false, False and FALSE are booleans. Older YAML 1.1 parsers also treated yes, no, on and off as booleans, which caused well-known surprises such as the country code NO becoming false. Under YAML 1.2 these values stay strings.
Are YAML comments kept in the JSON output?
No. JSON has no comment syntax, so comments, blank lines, quoting style and indentation are dropped when converting YAML to JSON. Converting the JSON back to YAML produces equivalent data, not your original file.
What happens to anchors and aliases?
Each alias is replaced by a copy of the anchored value, because JSON has no references. The number of aliases and the size of the expanded result are limited, and aliases that refer to themselves are rejected because cyclic data cannot be written as JSON.
Can I convert a file with several YAML documents separated by ---?
Not in one step. A JSON document holds exactly one value, so input with more than one YAML document is rejected rather than silently keeping only the first. Convert each document separately.
Why was my number rejected?
Integer digits are kept exactly within the input and output size limits. Decimal and exponent-form numbers are rejected if they overflow, underflow or change their written numeric value after number serialization. Numeric spelling is normalized, including negative zero to 0. Other applications may round large integers, so quote identifiers that must remain exact across applications. NaN and infinity are rejected because JSON cannot represent them.
Why are merge keys (<<) and custom tags not supported?
Merge keys were a YAML 1.1 extension and are not part of YAML 1.2, and custom tags such as !Ref or !!binary describe application-specific types with no JSON equivalent. Rather than guess their meaning, the converter reports them so you can rewrite those parts explicitly.
Is my data uploaded?
No. Parsing and conversion run in your browser. Pasted text and opened files are not sent to a server, logged, sent to analytics or stored.