Deeply nested sample JSON file
Last updated 2026-05-20
Example JSON
A deeply nested object — 12 levels of recursion.
{}Request examples
function depth(o) {
if (!o || typeof o !== 'object') return 0;
return 1 + Math.max(0, ...Object.values(o).map(depth));
}
const data = JSON.parse(fs.readFileSync('./sample-nested.json', 'utf8'));
console.log('depth =', depth(data));