JSON1

JSON1 / JSON to YAML

JSON to YAML

Convert JSON to YAML. Strings that would otherwise read as booleans, numbers, or nulls are quoted so the result parses back to the same value.

Processed locally
InputJSON
Ready
OutputYAML

Converted output appears here as you type.

About this tool

YAML expresses the same data as JSON but leans on indentation instead of braces, which makes it the usual choice for configuration a person has to read and edit. Every JSON document is convertible, since JSON is a subset of YAML.

The hazard is that YAML infers types from unquoted text. A string like yes, off, null, or 1.0 would come back as a boolean, a null, or a number, so this converter quotes any string whose bare form would parse as something else. The result reloads to exactly the values you started with.

Why did some of my strings come back quoted and others not?
Only the ambiguous ones are quoted. name: Ada is unmistakably a string, so quotes would be noise, but version: "1.0" needs them or YAML reads it as the number 1. This is sometimes called the Norway problem, after country code NO becoming false.
Are the indentation and key order stable?
Yes. Nested mappings indent by two spaces and keys keep the order they had in the JSON, so the output is diffable against a previous run.