Convert JSON and YAML Locally
Convert strict JSON to YAML or a JSON-compatible YAML subset to JSON, preserving member order and numeric spelling in your browser.
Tool workspace
YAML 1.2.2, JSON-compatible subset
Paste text or choose one local UTF-8 file. Conversion starts only when you press Convert.
Choose a direction and enter text, or insert an example.
A local Worker is unavailable. Conversion cannot run in this browser.
Read-only preview. Copy and download use the complete current output.
Diagnostics and notices
Some details are omitted or inspection could not finish. Counts describe the inspected input.
Supported capabilities
One document; string keys; numbers written as JSON. Comments and formatting are omitted. Tags, anchors, aliases and merge keys are outside this subset.
Plain yes and dates are strings; true is boolean; quote a key 1; a: is null.
For an unsupported YAML number, use a supported JSON spelling or quote it if you want a string. Numeric lexemes are preserved; other consumers may round large integers or precise decimals, or turn a very small number into zero.
Limits
Input: 1,000,000 UTF-16 units / 4,000,000 UTF-8 bytes. Output: 2,000,000 units / 8,000,000 bytes. File: 4,000,000 bytes. Depth: 100. Values: 100,000.
Processed locally. Your text and files are neither uploaded nor saved.
JSON → YAML: choose how to write strings
Choose JSON → YAML, paste strict JSON or load one local .json file, then press Convert. Choose 2 or 4 spaces and quoted strings (default) or literal multiline blocks. Conversion never starts automatically and the original input stays in the editor.
{"code":"00123","active":true,"missing":null,"items":[1,"yes",false,null,{},[]],"message":"Hello\nWorld\n"}
The default output quotes every key and string. Literal mode uses a block only when it preserves the string exactly; otherwise it keeps quotes. It preserves empty containers, heterogeneous arrays, strings and member order. JSONC, JSON5, duplicate keys, repair and automatic format detection are outside this tool.
YAML → JSON: resolve data, not formatting
Choose YAML → JSON, paste text or load one .yaml or .yml file, choose 2 or 4 spaces, then press Convert. File extensions are case insensitive; a MIME label does not make a file acceptable. Files must be strict UTF-8. One initial UTF-8 BOM is removed with a notice; two initial BOMs are rejected. Original LF/CRLF/CR line endings remain in the source model.
# A local example; the comment is omitted from JSON
code: "00123"
active: true
missing:
items: [1, "yes", false, null, {}, []]
message: |
Hello
World
missing: is an implicit null. Quoted "00123" is a string, while plain 00123 is rejected as a number outside this profile. Plain yes and dates such as 2026-10-04 are strings; true is boolean. An unquoted key 1 is not a string key and is rejected; quote it as "1".
YAML 1.2.2, a JSON-compatible subset
This is not a general YAML editor. It supports one document, string-key maps, arrays, strings, finite numbers written with JSON grammar, booleans, null, block/flow collections and literal/folded blocks. A single valid %YAML 1.2 directive with its document-start marker is accepted. Explicit tags, anchors, aliases, unquoted merge keys, duplicate keys, non-string keys, multiple documents and other directives are rejected. An error distinguishes invalid syntax from a valid YAML construction outside the subset.
Numbers such as 0x10, +1 or .inf are outside the numeric profile. Use a supported JSON spelling where appropriate, or quote the value if you want a string; the converter does not repair it. A value like 1_000 remains a string under the supported scalar classification rather than being coerced into a number. Non-finite overflow is rejected.
Numeric spelling and round trips
Lexemes such as -0, 1.0, 1e0, 9007199254740993, 0.1234567890123456789 and 1e-400 keep their original numeric spelling. Review precision notices: other consumers can round a large integer or precise decimal, or turn an underflowing value into zero. Preserving the text does not guarantee another program’s numeric precision.
A round trip preserves resolved values, strings, array order, literal member names/order and numeric lexemes within this subset. YAML comments are omitted with an exact count. Original style, comments, directives, quoting and block layout are not reconstructed. Literal/folded YAML blocks first resolve to their string value, then JSON escapes that value.
Complete exports, bounded preview and local limits
Copy and download export the complete current output, even when the read-only preview shows only 20,000 UTF-16 units. After a clipboard failure, an explicit action shows the complete text for manual copying. Downloads are converted.yaml (application/yaml) or converted.json (application/json), UTF-8 without BOM and with final LF.
Limits are 1,000,000 input UTF-16 units and 4,000,000 input UTF-8 bytes; 2,000,000 output units and 8,000,000 output bytes; one file up to 4,000,000 bytes; 250,000 source or decoded units per scalar/key; 100 nested containers; 100,000 values; 300,000 syntax tokens; 4,000,000 own work units; 100 retained diagnostic details; and a 10,000 ms Worker deadline. UTF-16 can constrain an input before the byte cap. All caps apply together; detailed locations are bounded, while warning counts remain observable.
Processing uses a local cancelable Worker. Text/files are not uploaded, saved in browser storage or added to URLs. Edit, options, mode, example, clear or file selection invalidate output and export actions. A limit, error, cancellation or timeout produces no partial output and cannot revive an older result. Clear keeps the chosen direction and restores option defaults. Cancel keeps the input so you can retry. Without JavaScript or a local Worker, conversion is unavailable.