class method
self.encode
Ruby on Rails 4.2.9
Since v2.2.3Signature
self.encode(value, options = nil)
Dumps objects in JSON (JavaScript Object Notation). See www.json.org for more info.
ActiveSupport::JSON.encode({ team: 'rails', players: '36' }) # => "{\"team\":\"rails\",\"players\":\"36\"}"
Parameters
-
valuereq -
optionsopt = nil
Source
# File activesupport/lib/active_support/json/encoding.rb, line 21
def self.encode(value, options = nil)
Encoding.json_encoder.new(options).encode(value)
end
Defined in activesupport/lib/active_support/json/encoding.rb line 21
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::JSON