# File lib/json/common.rb, line 337
337:   def JSON(object, opts = {})
338:     if object.respond_to? :to_str
339:       JSON.parse(object.to_str, opts)
340:     else
341:       JSON.generate(object, opts)
342:     end
343:   end