MAX_JSON_DEPTH

Constant MAX_JSON_DEPTH 

Source
pub const MAX_JSON_DEPTH: usize = 32;
Expand description

Maximum allowed JSON nesting depth

This limit prevents DoS attacks via deeply nested JSON that can cause:

  • Stack overflow
  • Excessive memory consumption
  • CPU exhaustion during parsing

A depth of 32 is sufficient for legitimate API responses while protecting against malicious payloads. Most real-world APIs use <10 levels of nesting.