instance method
decode
Ruby on Rails 3.0.20
Since v2.3.18 Last seen in v3.0.20Available in: v2.3.18 v3.0.20
Signature
decode(json)
Parses a JSON string or IO and convert it into an object
Parameters
-
jsonreq
Source
# 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
Defined in activesupport/lib/active_support/json/backends/jsongem.rb line 11
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::JSON::Backends::JSONGem