method
encode

encode(value, options = nil)
public
Dumps objects in JSON (JavaScript Object Notation). See http://www.json.org for more info.
ActiveSupport::JSON.encode({ team: 'rails', players: '36' }) # => "{\"team\":\"rails\",\"players\":\"36\"}"