# File lib/json/pure/generator.rb, line 305
          def to_json(state = nil, depth = 0, *)
            if state
              state = State.from_state(state)
              state.check_max_nesting(depth)
            end
            json_transform(state, depth)
          end