Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
class method
Psych.to_json
(?::JSON::State? state) -> ::String
to_json(object)
ext/psych/lib/psych.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.4.1/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_file
.unsafe_load
.safe_load
.unsafe_load_file
also in
4.1 · 4.0 · 3.3 · 3.2 · 3.1 · 3.0