module Kernel
def JSON(object, *args)
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.respond_to? :to_str JSON.parse(object.to_str, args.first) else JSON.generate(object, args.first) end end
def j(*objs)
Outputs _objs_ to STDOUT as JSON strings in the shortest form, that is in
def j(*objs) objs.each do |obj| puts JSON::generate(obj, :allow_nan => true, :max_nesting => false) end nil end
def jj(*objs)
Outputs _objs_ to STDOUT as JSON strings in a pretty format, with
def jj(*objs) objs.each do |obj| puts JSON::pretty_generate(obj, :allow_nan => true, :max_nesting => false) end nil end