End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
JSON::GenericObject.from_hash
from_hash(object)
ext/json/lib/json/generic_object.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.0.5/ext/json/lib/json/generic_object.rb, line 21
def from_hash(object)
case
when object.respond_to?(:to_hash)
result = new
object.to_hash.each do |key, value|
result[key] = from_hash(value)
end
result
when object.respond_to?(:to_ary)
object.to_ary.map { |a| from_hash(a) }
else
object
end
end
No documentation available