class Exception
def as_json(*)
Exception.json_create(x) # => #
\Method +JSON.create+ deserializes such a hash, returning a \Exception object:
x = Exception.new('Foo').as_json # => {"json_class"=>"Exception", "m"=>"Foo", "b"=>nil}
require 'json/add/exception'
returning a 2-element hash representing +self+:
\Method Exception#as_json serializes +self+,
see Marshal[https://docs.ruby-lang.org/en/master/Marshal.html].
to serialize and deserialize a \Exception object;
Methods Exception#as_json and +Exception.json_create+ may be used
def as_json(*) { JSON.create_id => self.class.name, 'm' => message, 'b' => backtrace, } end