Method: Time#to_json

Defined in:
lib/json/add/time.rb

#to_json(*args) ⇒ Object

Returns a JSON string representing self:

require 'json/add/time'
puts Time.now.to_json

Output:

{"json_class":"Time","s":1700931678,"n":980650786}


49
50
51
# File 'lib/json/add/time.rb', line 49

def to_json(*args)
  as_json.to_json(*args)
end