Skip to content
Oblicznik

Practical guide

How to convert JSON to YAML without changing types

A readable configuration should not accidentally turn a string code into a number. This guide covers converting JSON structure into a bounded YAML profile and checking output in the application that will read it.

Oblicznik editorial teamReviewed: 2 October 2026

Prepare one JSON document

Paste a complete JSON document, choose two or four spaces and select “Process”. The root may be an object, array or scalar. Input is pasted text; the tool does not read a file or validate a specific application’s configuration. If uncertain, check syntax with the JSON formatter.

Member names and strings need double quotes. Comments, NaN, Infinity, trailing commas and duplicate names are rejected. Preserve leading zeros with string "001", not the invalid JSON number 001. Do not remove quotes merely because YAML can use less explicit notation.

Compare input and output

Output uses block style and always quotes keys and strings. Arrays use hyphen-prefixed lines and nested containers are indented. Empty objects and arrays remain {} and []. This is the implementation’s chosen style, not the only valid YAML representation. A final newline is part of copied output.

The Łódź example distinguishes a string code from a boolean. The second shows an empty array and numbers whose spelling should remain exact. Compare member names, array order and value types; switching between two and four-space indentation should not change structure. Original JSON whitespace is not retained.

Output with two-space indentation
JSONYAML
{"city":"Łódź","code":"001","active":true}"city": "Łódź" "code": "001" "active": true
{"values":[1.00,9007199254740993],"empty":[]}"values": - 1.00 - 9007199254740993 "empty": []

Preserve strings and special characters

Strings resembling numbers, dates or booleans remain quoted. "true" stays a string, true stays boolean and null does not become an empty string. Polish characters and emoji remain in output. String line breaks use escapes rather than a multiline literal block.

Selected control and Unicode line-separator characters are escaped so YAML syntax does not change their meaning. Unpaired Unicode surrogates are rejected. If an editor replaces quotes with typographic characters or changes file encoding, recheck the saved representation before using it as configuration.

Exact tokens do not guarantee receiver precision

The engine does not convert JSON numbers to Number before export. Thus 1.00, -0, 1e400 and 9007199254740993 retain their spelling. A YAML receiver may nevertheless use floating-point numbers, change spelling or report an overflow. Preserved text does not guarantee every library will interpret it correctly.

If a member is a string identifier, determine its type from the API contract. Do not quote an amount or unquote a code without checking receiver requirements. A reverse conversion can confirm structure but does not replace testing in the destination parser and validating configuration.

Limits and saved-file review

Input is capped at 50,000 UTF-16 units and 10,000 values; this converter allows 32 container levels and 500,000 output units. All caps apply together. On failure, reduce to a complete structure rather than cutting through a document. A deliberately truncated, apparently valid export is not returned.

The converter adds no anchors, aliases or tags and does not combine similar structures through references. Copy output into a suitably encoded editor, such as UTF-8, retain spaces and check the destination parser. Syntactically valid YAML can still contain unsupported members or unsafe application settings.

Privacy, copying and reset

For conversions and schemas, use short anonymized samples instead of production exports. Input and output are processed in the browser without sending them to analytics or keeping history in localStorage or sessionStorage. Page loading still connects your device to hosting. Extensions and clipboard contents remain outside this protection.

Editing clears the old result; select “Process” again. Copying is a separate action. “Clear” restores the form and initial options but cannot remove earlier copies, saved files or printouts. When reporting an issue, include a short synthetic example, selected options and expected output. Do not include secrets or customer data.

Frequently asked questions

Why are strings always quoted?

This deliberate export style preserves string codes and avoids accidental type resolution.

Does the converter validate configuration?

No. It converts structure; destination-application rules need separate checking.

Is a large number safe in every parser?

No. Spelling is exact, but a receiver may round or limit numeric range.

Does clearing remove the clipboard copy?

No. The form is reset; earlier clipboard copies, files or printouts need separate removal.

Sources and scope

Examples are synthetic. Limits and supported options describe this site’s tools, not the full standards. Check output in its destination system. This guide does not establish API-contract compliance, configuration security or business-rule correctness.

Tools covered by this guide

Generator

UUID and GUID generator

Generate 1–100 UUIDv4 identifiers using Web Crypto randomness, locally and without a timestamp.

Generator

JSON to YAML converter

Convert JSON into readable YAML with quoted strings, no anchors and unchanged number tokens.

Generator

YAML to JSON converter

Read a single YAML 1.2 document and produce JSON without alias expansion or lost large numbers.

Generator

JSON Schema generator

Create a working JSON Schema 2020-12 from a sample with an explicit additional-object-members policy.