to_json(*args) -> StringRuby 2.7.0 から Ruby 4.1 で削除[permalink][rdoc][edit] [added by json/add/set]-
自身を JSON 形式の文字列に変換して返します。
内部的には Set#as_json で得たハッシュに対して JSON::Ext::Generator::GeneratorMethods::Hash#to_json を呼び出しています。
- [PARAM]
args: - 引数はそのまま JSON::Ext::Generator::GeneratorMethods::Hash#to_json に渡されます。
require 'json/add/set' p Set[1, 2, 3].to_json # => "{\"json_class\":\"Set\",\"a\":[1,2,3]}"[SEE_ALSO] JSON::Ext::Generator::GeneratorMethods::Hash#to_json
- [PARAM]