Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

ObjectSpace#dump

ObjectSpace.dump(obj[, output: :string]) # => "{ ... }"
ObjectSpace.dump(obj, output: :file) # => #<File:/tmp/rubyobj20131125-88733-1xkfmpv.json>
ObjectSpace.dump(obj, output: :stdout) # => nil

Dump the contents of a ruby object as JSON.

This method is only expected to work with C Ruby. This is an experimental method and is subject to change. In particular, the function signature and output format are not guaranteed to be compatible in future versions of ruby.