Boneyard Tools

JSON to YAML Converter

Paste any valid JSON and this tool prints the same data as YAML, using a 2-space indent and no line wrapping so long strings stay on one line. It handles objects, arrays, deep nesting and bare scalars like a single number or quoted string. Everything runs in your browser, so the data you paste is never uploaded.

How to convert JSON to YAML

  1. Paste or type your JSON into the 'JSON input' box, or click 'Load sample' to try a nested example.
  2. Watch the 'YAML output' box below fill in automatically as you type.
  3. If the input is not valid JSON, read the red error message and fix the quote, comma or brace it names.
  4. Click Copy to put the YAML on your clipboard.
  5. Or click Download to save it as data.yaml.

Examples

Object with a string array

{"name":"Ada","roles":["admin","dev"]}
name: Ada
roles:
  - admin
  - dev

Nested object with booleans (the built-in sample)

{"name":"Ada","role":"Engineer","active":true,"skills":["systems","math"],"manager":{"name":"Linus","id":7}}
name: Ada
role: Engineer
active: true
skills:
  - systems
  - math
manager:
  name: Linus
  id: 7

Numbers, false and null

{"port":8080,"debug":false,"tags":null}
port: 8080
debug: false
tags: null

Frequently asked questions

What is the difference between JSON and YAML?

Both describe the same data shapes: maps, lists, strings, numbers, booleans and null. JSON marks structure with braces, brackets and commas, while YAML uses indentation and dashes, which many people find easier to scan and hand-edit. JSON is stricter and dominates APIs; YAML is common for config files.

How is the YAML indented and wrapped?

Each nesting level is indented by 2 spaces, and line wrapping is disabled, so a long string is never broken across lines. That keeps the output stable and diff-friendly, which matters for config files checked into git.

Does it handle nested objects and arrays?

Yes. Objects become YAML maps and arrays become dash-prefixed sequences, nested to any depth. The built-in sample shows a nested manager object and a skills array converted in one pass.

Can I convert a bare value that is not an object?

Yes. A lone number, quoted string, boolean or null is valid JSON, so 42 converts to 42 and "hi" converts to hi. Whole arrays at the top level also work and become a sequence of dash lines.

What happens if my JSON is invalid?

The tool tries to parse the input and, if it fails, shows an 'Invalid JSON' message with the parser's reason, such as an unexpected token. The output box stays empty until the JSON parses cleanly, so a trailing comma or a single quote will block it.

Are comments kept in the conversion?

No. JSON has no comment syntax, so there is nothing to carry over, and the YAML holds only your data. YAML does support comments with the # character, so you can add them to the output yourself afterward.

Does the key order change?

No. Keys are emitted in the same order they appear in your JSON object, not sorted alphabetically. What you paste top to bottom is what you get top to bottom.

Is my data uploaded anywhere?

No. Parsing and conversion happen entirely in your browser with a local library, so your JSON never leaves your device. That makes it safe for config that contains internal names or secrets.

How do I go the other way, from YAML back to JSON?

Use the YAML to JSON converter, linked under related tools. It reverses the process and is handy when a service or API expects JSON but your config lives in YAML.

Learn more

Related tools