Ruby 3.2 リファレンスマニュアル > ライブラリ一覧 > jsonライブラリ > JSON::Stateクラス > depth=
depth=(depth)
This sets the maximum level of data structure nesting in the generated JSON to the integer depth, max_nesting = 0 if no maximum should be checked.