Skip to content
JSON Runs offline

JSON to YAML Converter

Turn JSON into readable YAML configuration.

Input

0 chars

Output

0 chars
Ctrl

Questions

When does a string get quoted?

On the default setting, only when leaving it bare would change its meaning: it would otherwise resolve as a number, boolean or null, it starts with a YAML indicator character, it contains a colon-space or a space-hash, or it has leading or trailing whitespace. So "1.0" and "true" come back quoted while hello world does not. Choosing single or double quotes instead quotes every string value; keys are still quoted only when they need it.

How are multi-line strings written?

As a block scalar with the | indicator, so the text stays readable instead of collapsing into one line full of \n escapes. The chomping indicator is chosen to match the original: |- when the string has no trailing newline, | for exactly one, |+ for more. Strings whose lines carry leading or trailing spaces fall back to quoting, because a block scalar would silently lose that whitespace.

Does the output use anchors?

No. Repeated structures are written out in full each time. JSON has no way to express a shared reference, so there is nothing in the input that says two identical blocks were ever meant to be the same node.

Is the conversion reversible?

Yes for anything JSON can hold. Feeding the output into the YAML to JSON converter returns the document you started with, including strings that look like numbers, booleans or nulls - that round trip is asserted in this project test suite.

Open JSON Formatter

JSON Formatter

Format, indent and inspect JSON with clear error reporting.

JSON