# File lib/json/pure/generator.rb, line 212
212:           def to_json(state = nil, depth = 0, *)
213:             if state
214:               state = JSON.state.from_state(state)
215:               state.check_max_nesting(depth)
216:               json_check_circular(state) { json_transform(state, depth) }
217:             else
218:               json_transform(state, depth)
219:             end
220:           end