Test files › Structured data › deeply-nested-100000.json
Deeply nested JSON test file
A single value wrapped in 100,000 levels of nested arrays. Only ~200 KB on disk.
↓ Download deeply-nested-100000.json| Filename | deeply-nested-100000.json |
| Format | JSON |
| Size | 195 KB (200,002 bytes) |
| MIME type | application/json |
| SHA-256 | 8d7bd09c0573c0c4d854b55795e2c3f1a781c2d4f2901de332a5cb8bab350e42 |
What this file catchesRecursive-descent parsers that blow the stack. Note that the two most common runtimes do NOT fail here: V8 JSON.parse and CPython's C scanner are both iterative and accept 1M levels. What this does catch is recursive implementations - Go encoding/json before its depth cap, many Ruby and PHP libraries, pure-Python fallback scanners, and hand-rolled parsers. The property worth asserting is that your service returns a 400 with a depth-limit message rather than either a 500 or a successful parse of an absurd document.
Handle it in code
Each snippet below was run against this exact file with Python 3.14.4 and Node 24.15.0 when this page was built, and the output shown is what it printed.
Python
Deep nesting exhausts the parser's recursion limit. Catch it, and reject the input as too deep rather than crashing the worker.
import json
try:
with open("deeply-nested-100000.json", encoding="utf-8") as f:
json.load(f)
print("parsed")
except RecursionError:
print("rejected: nested too deeply to parse")Run against this file, it prints: rejected: nested too deeply to parse
Node.js
Check whether your runtime copes before trusting it with uploads: a crash here takes the whole process down.
const fs = require('node:fs');
try {
JSON.parse(fs.readFileSync('deeply-nested-100000.json', 'utf8'));
console.log('parsed');
} catch (e) {
console.log('rejected:', e.name, e.message);
}Run against this file, it prints: parsed
Related guides and tools
Download & verify
curl -fsSL -o "deeply-nested-100000.json" "https://files.hexaqa.com/json/deeply-nested-100000.json"
curl -fsSL "https://files.hexaqa.com/json/deeply-nested-100000.json" | sha256sum
# expect: 8d7bd09c0573c0c4d854b55795e2c3f1a781c2d4f2901de332a5cb8bab350e42