module Kernel

def JSON(object, *args)

generate and parse for their documentation.
The _opts_ argument is passed through to generate/parse respectively. See

structure object and return it.
a Ruby data structure. Otherwise, generate a JSON text from the Ruby data
If _object_ is string-like, parse the string and return the parsed result as
def JSON(object, *args)
  if object.is_a?(String)
    return JSON.parse(object, args.first)
  elsif object.respond_to?(:to_str)
    str = object.to_str
    if str.is_a?(String)
      return JSON.parse(object.to_str, args.first)
    end
  end
  JSON.generate(object, args.first)
end