class ActiveSupport::JSON::Encoding::JSONGemEncoder

def jsonify(value)

Experimental RBS support (using type sampling data from the type_fusion project).

def jsonify: ((String | Array[String] | Integer) value) -> untyped

This signature was generated using 29 samples from 1 application.

calls.
to +object.as_json+, not any of this method's recursive +#as_json+
Note: the +options+ hash passed to +object.to_json+ is only passed

or having to remember to call #as_json recursively.
worry about what base types of objects they are allowed to return
This allows developers to implement #as_json without having to

fully JSON-ready object.
Recursively calls #as_json to the object to recursively build a
and +true+/+false+/+nil+.
primitives like Hash, Array, String, Numeric,
Convert an object into a "JSON-ready" representation composed of
def jsonify(value)
  case value
  when String
    EscapedString.new(value)
  when Numeric, NilClass, TrueClass, FalseClass
    value.as_json
  when Hash
    result = {}
    value.each do |k, v|
      result[jsonify(k)] = jsonify(v)
    end
    result
  when Array
    value.map { |v| jsonify(v) }
  else
    jsonify value.as_json
  end
end