instance method
JSON#fast_generate
(::_ToJson obj, ?::JSON::options opts) -> ::String
JSON.fast_generate(obj, opts) → new_string
ext/json/lib/json/common.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/ext/json/lib/json/common.rb, line 460
def fast_generate(obj, opts = nil)
if RUBY_VERSION >= "3.0"
warn "JSON.fast_generate is deprecated and will be removed in json 3.0.0, just use JSON.generate", uplevel: 1, category: :deprecated
else
warn "JSON.fast_generate is deprecated and will be removed in json 3.0.0, just use JSON.generate", uplevel: 1
end
generate(obj, opts)
end
Arguments obj and opts here are the same as arguments obj and opts in JSON.generate.
By default, generates JSON data without checking for circular references in obj (option max_nesting set to false, disabled).
Raises an exception if obj contains circular references:
Example
a = []; b = []; a.push(b); b.push(a) # Raises SystemStackError (stack level too deep): JSON.fast_generate(a)