pub const MAX_DEPTH: usize = 64;Expand description
How deeply arrays and objects may nest before parsing is refused.
Recursive descent uses stack in proportion to nesting, and a stack overflow
in Rust is an abort rather than an error: nothing unwinds and no caller can
recover. Before this limit existed, two kilobytes of [[[[...]]]] ended the
process – which matters because icrypto mcp parses JSON-RPC from whatever
is on the other end of its stdin.
64 is chosen against measurement rather than taste. The deepest document this project produces is the JSON Schema export, at 7; JSON-LD reaches 5 and the SBOM 6. That is an order of magnitude of headroom, and far below the roughly one thousand that exhausts the stack.