Module: Crack::JSON::Backends::Yajl

Extended by:
Yajl
Included in:
Yajl
Defined in:
lib/crack/json/backends/yajl.rb

Instance Method Summary collapse

Instance Method Details

#decode(json) ⇒ Object

Converts a JSON string into a Ruby object.



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/crack/json/backends/yajl.rb', line 11

def decode(json)
  if !json.respond_to?(:read)
    json = StringIO.new(json)
  end
  data = ::Yajl::Parser.parse(json)
  if Crack.parse_json_times
    convert_dates_from(data)
  else
    data
  end
end