instance method JSON::Generator::GeneratorMethods::NilClass#to_json

to_json(state_or_hash = nil) -> String[permalink][rdoc][edit]

自身から生成した JSON 形式の文字列を返します。

"null" という文字列を返します。

[PARAM] state_or_hash:
生成する JSON 形式の文字列をカスタマイズするために JSON::State のインスタンスか、 JSON::State.new の引数と同じ Hash を指定します。


require "json"

nil.to_json # => "null"