instance method
decode
Ruby on Rails 2.3.18
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/okjson.rb, line 608
def decode(json)
if json.respond_to?(:read)
json = json.read
end
data = ActiveSupport::OkJson.decode(json)
if ActiveSupport.parse_json_times
convert_dates_from(data)
else
data
end
end
Defined in activesupport/lib/active_support/json/backends/okjson.rb line 608
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::JSON::Backends::OkJson