pub fn validate_json_depth(
value: &Value,
max_depth: usize,
) -> Result<(), ValidationError>Expand description
Validate that a JSON value is not nested more than max_depth levels deep.
Deeply nested JSON can cause stack overflows during recursive processing. The limit of 32 levels is generous for real data but blocks malicious inputs like { a: { b: { c: … } } } with hundreds of levels.
Uses a recursive inner function — the outer function is the public API.