Tested scalar, date and precision results
These are actual results from js-yaml 5.4.2 and this converter’s options, not promises about every YAML parser. The complete inputs and outputs are available below.
| Input | Actual result | Consequence |
|---|---|---|
| code: "0012" / count: 0012 | code is "0012"; count is 12 | Quote identifiers when leading zeros matter. |
| day: 2026-10-15 | "day": "2026-10-15" | This tested bare date remains a string. |
| {"id":9007199254740993} | id: 9007199254740992 | Standard JavaScript numbers can lose precision. |
| defaults: &defaults / service: *defaults | Both objects contain the same enabled value | JSON output expands data without anchor notation. |
| name: Ada / name: Linus (two lines) | Duplicate mapping key at line 2, column 1 | Duplicate keys are rejected. |
What does the JSON to YAML Converter — Convert Both Ways Locally do?
KitLumi converts one complete JSON or YAML document in the current tab. Nested objects, arrays, strings, booleans and null can pass through a JSON-compatible data model. Formatting, comments, anchors and exact numeric spelling are not preserved as source text.
When is a JSON/YAML round trip appropriate?
Use a round trip for JSON-compatible data after checking types and precision. Keep the source when comments, YAML anchors, custom tags or exact spelling matter. The standard JavaScript number model can round large integers before output; store exact identifiers as quoted strings when your data contract permits it.
How do you use it?
- Select JSON → YAML or YAML → JSON. Paste one complete document.
- Run the conversion and inspect the result, especially identifiers, dates, null and arrays.
- Copy or download the .yaml or .json output. Keep the original document and validate the result against your application contract.
Worked example
Convert an object while retaining a quoted identifier
Input
{"service":{"enabled":true,"code":"0012","tags":["yaml","json"]}}Output
service:
enabled: true
code: '0012'
tags:
- yaml
- json
The value 0012 remains a string and the YAML writer adds quotes. enabled remains a boolean and tags remains an array. Exact quote style and whitespace are generated by the writer, not preserved from the input.
Common errors and fixes
| Symptom | Likely cause | Fix |
|---|---|---|
| JSON input is rejected. | Strict JSON disallows comments, trailing commas and unquoted keys. | Use double-quoted keys and strings, remove comments and trailing commas, and check the reported syntax location. |
| YAML contains a duplicate-key error. | The same mapping key appears twice in one mapping. | Keep one value per key or use a sequence. name: Ada followed by name: Linus fails at line 2, column 1 in the published example. |
| An identifier loses leading zeros. | An unquoted YAML numeric scalar is parsed as a number. | Use a quoted string such as "0012" for an identifier. The tested unquoted value 0012 becomes the number 12. |
| A large integer changes its last digit. | JSON.parse and the parser data model use JavaScript numbers. | The tested 9007199254740993 becomes 9007199254740992 in both directions. Do not use this converter as a lossless-number parser; preserve exact IDs as strings when appropriate. |
| Comments or anchors disappear. | JSON has no representation for source comments or anchor syntax, and new YAML is written with noRefs. | Keep the original YAML as the authoritative source. Aliased values can be expanded while their original anchor notation is lost. |
Syntax acceptance does not establish a valid application configuration
The converter does not fetch remote schemas, check business rules or execute input. Current parser behavior is documented by downloadable cases. A bare date such as 2026-10-15 remains a string in the tested parser version; do not infer universal timestamp behavior across other parsers or schemas.
Standards and implementation references
- js-yaml documentation (opens in a new tab)Parser/writer APIs, schemas, duplicate keys and noRefs.
- YAML 1.2.2 specification (opens in a new tab)Mappings, sequences, scalars, aliases and tags.
- RFC 8259: JSON (opens in a new tab)JSON syntax and interoperable numeric limits.
Frequently asked questions about JSON ↔ YAML
Does this upload JSON or YAML?
No. Parsing, serialization, copy and download run in the current browser tab.
Does converting validate a Kubernetes or application schema?
No. A document may parse successfully while using invalid names, values or required fields for its destination. Run the relevant schema or application validation separately.
Will YAML dates become JSON timestamps?
In the published case, both day: 2026-10-15 and quoted: "2026-10-15" produce the string "2026-10-15" with this parser version. Other timestamp forms and parser settings can differ; inspect actual output.
Are large numbers and source comments lossless?
No. The tested integer 9007199254740993 is rounded to 9007199254740992, and comments or anchor notation do not survive this data-model conversion.
Which output file is downloaded?
JSON → YAML downloads a .yaml file; YAML → JSON downloads a .json file. The file contains the generated output and does not overwrite your source.
What changed?
Published tested inputs and outputs for scalar types, a date, duplicate keys, alias expansion and number precision; clarified syntax validation and download boundaries.