File: json_gem.rb

package info (click to toggle)
ruby-yajl 1.4.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 4,036 kB
  • sloc: ansic: 3,068; ruby: 2,619; makefile: 4; sh: 3
file content (13 lines) | stat: -rw-r--r-- 314 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
require 'yajl' unless defined?(Yajl::Parser)
require 'yajl/json_gem/parsing'
require 'yajl/json_gem/encoding'

module ::Kernel
  def JSON(object, opts = {})
    if object.respond_to? :to_s
      JSON.parse(object.to_s, JSON.default_options.merge(opts))
    else
      JSON.generate(object, opts)
    end
  end
end