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

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

Constant Summary collapse

ParseError =
::JSON::ParserError

Instance Method Summary collapse

Instance Method Details

#decode(json) ⇒ Object

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



11
12
13
14
15
16
17
18
19
20
21
# File '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