class Rational

def to_json(*args)


{"json_class":"Rational","n":2,"d":3}

Output:

puts Rational(2, 3).to_json
require 'json/add/rational'

Returns a JSON string representing +self+:
def to_json(*args)
  as_json.to_json(*args)
end