Module: ActiveSupport::JSON::Backends::JSONGem

Extended by:
JSONGem
Defined in:
activesupport/lib/active_support/json/backends/jsongem.rb

Constant Summary

Instance Method Summary (collapse)

Instance Method Details

- (Object) decode(json)

Parses a JSON string or IO and convert it into an object



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

def decode(json)
  if json.respond_to?(:read)
    json = json.read
  end
  data = ::JSON.parse(json)
  if ActiveSupport.parse_json_times
    convert_dates_from(data)
  else
    data
  end
end