class OpenStruct
def to_json(*args)
{"json_class":"OpenStruct","t":{'name':'Rowdy',"age":null}}
Output:
puts OpenStruct.new('name' => 'Rowdy', :age => nil).to_json
require 'json/add/ostruct'
Returns a JSON string representing +self+:
def to_json(*args) as_json.to_json(*args) end