Convert Nested JSON to YAML — Deep Structures, Arrays of Arrays
- YAML handles any nesting depth — indentation just grows by 2 spaces per level.
- Above 8-10 levels deep, YAML becomes hard to read. Consider flattening the structure first.
- Arrays of arrays produce stacked list markers; arrays of objects produce list-of-dicts, which is the cleanest nested pattern.
Table of Contents
JSON can nest to any depth — objects inside objects, arrays of arrays, mixed shapes. YAML handles them all, but deep nesting (past 8-10 levels) gets hard to read. This guide covers how our browser converter handles nested structures, what the output looks like for common patterns, and when you should flatten the JSON before converting.
How Nesting Maps to Indentation
Every level of JSON nesting becomes 2 spaces of YAML indentation:
// JSON
{"a":{"b":{"c":{"d":"deep"}}}}
// YAML
a:
b:
c:
d: deep
Our converter uses 2-space indentation by default (standard YAML convention). At 10 levels deep, your content is 20 spaces from the left edge. Readable, but narrow terminals start to wrap lines awkwardly.
Arrays of Objects — the Clean Pattern
The most common nested structure: an array where each item is an object.
// JSON
{"users":[
{"name":"Ana","role":"admin","active":true},
{"name":"Ben","role":"viewer","active":false}
]}
// YAML
users:
- name: Ana
role: admin
active: true
- name: Ben
role: viewer
active: false
Clear visual grouping: each - starts a new object, and the object's fields align under it. This pattern works at any nesting depth — arrays of objects inside objects inside arrays all render cleanly.
Arrays of Arrays — Readable but Dense
// JSON
{"matrix":[[1,2,3],[4,5,6],[7,8,9]]}
// YAML
matrix:
- - 1
- 2
- 3
- - 4
- 5
- 6
- - 7
- 8
- 9
Stacked - - markers are valid but visually busy. For numeric matrices, consider using YAML's flow style: matrix: [[1,2,3], [4,5,6], [7,8,9]]. Our converter uses block style by default; hand-edit to flow for dense numeric data.
When to Flatten Before Converting
If your JSON is deeply nested (10+ levels) but the deep fields are actually flat paths, consider flattening to dot-notation keys first:
// Original (deep)
{"app":{"server":{"network":{"tls":{"version":"1.3"}}}}}
// Flattened
{"app.server.network.tls.version":"1.3"}
Flattened YAML is more readable for config files with many deep single-path values:
app.server.network.tls.version: "1.3" app.server.network.tls.ciphers: [...]
Tradeoff: flattened loses the structural hierarchy some tools need. Only flatten if the consumer handles dot notation (Spring Boot properties, Java properties files, some Helm values).
Our converter preserves whatever structure you paste. Do the flattening before conversion with jq or a small script if needed.
Mixed Structures — When to Split Into Multiple Files
Very large nested JSON (500+ lines of YAML after conversion) is hard to review in a single file. Splitting into multiple YAML files, each handling one top-level section, helps:
config/base.yaml— common settings.config/services.yaml— service definitions.config/users.yaml— user/role data.
Most config loaders (Spring, Helm, Ansible) merge multiple files at load time. Review benefits from the split; runtime doesn't care.
Our converter handles each file separately. Convert the sections one at a time, save to appropriate filenames.
Convert Any Nesting Depth
Paste nested JSON, click Convert. Arrays of arrays, objects-in-objects — all rendered cleanly.
Open Free JSON to YAML ConverterFrequently Asked Questions
Is there a depth limit for nested JSON?
No code-level limit. Browser memory is the ceiling — around 50MB of JSON regardless of nesting. Past 20 levels deep, most human readers lose track; consider flattening the structure for readability.
Does the converter handle arrays of mixed types?
Yes — each array item is rendered per its type. [1, "two", {"three":3}] becomes a YAML list with a number, a string, and an object in order. Valid YAML, though most downstream parsers expect consistent types per array.
Can YAML flow style help dense nested data?
Yes for small, dense structures (matrices, flat lists). Our converter uses block style by default; hand-edit the output to flow style where it improves readability. Flow: {"key": [1, 2, 3]}. Block: key:\n - 1\n - 2\n - 3.
How do I handle circular references in JSON?
JSON doesn't support them natively — the source must be acyclic. If you somehow have circular refs (rare; usually JavaScript object serialization issues), break them before paste. Our converter will stack overflow on truly circular input.

