class DateTime
def to_json(*args)
{"json_class":"DateTime","y":2023,"m":11,"d":21,"sg":2299161.0}
Output:
puts DateTime.now.to_json
require 'json/add/datetime'
Returns a JSON string representing +self+:
def to_json(*args) as_json.to_json(*args) end