class method
Psych.to_json
(?::JSON::State? state) -> ::String
to_json(object)
ext/psych/lib/psych.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/ext/psych/lib/psych.rb, line 623
def self.to_json object
visitor = Psych::Visitors::JSONTree.create
visitor << object
visitor.tree.yaml
end
Dump Ruby object to a JSON string.
See also
.safe_load_stream
.unsafe_load
.safe_load_file
.unsafe_load_file
also in
4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0