# File lib/json/common.rb, line 202 def fast_generate(obj) result = obj.to_json(nil) if result !~ /\A(?:\[.*\]|\{.*\})\Z/ raise GeneratorError, "only generation of JSON objects or arrays allowed" end result end