# File lib/json/pure/generator.rb, line 266
266:           def to_json(state = nil, depth = 0, *)
267:             if state
268:               state = JSON.state.from_state(state)
269:               state.check_max_nesting(depth)
270:               json_check_circular(state) { json_transform(state, depth) }
271:             else
272:               json_transform(state, depth)
273:             end
274:           end