るりまサーチ

最速Rubyリファレンスマニュアル検索!
12件ヒット [1-12件を表示] (0.013秒)

別のキーワード

  1. mkmf have_struct_member
  2. struct []
  3. struct each
  4. struct select

クラス

検索結果

Struct#to_json(*args) -> String (9021.0)

自身を JSON 形式の文字列に変換して返します。

...まま JSON::Generator::GeneratorMethods::Hash#to_json に渡されます。

//emlist[例][ruby]{
require "json/add/core"

Person = Struct.new(:name, :age)
Person.new("tanaka", 29).to_json # => "{\"json_class\":\"Person\",\"v\":[\"tanaka\",29]}"
//}

@see JSON::Generator::GeneratorMethods::Hash#to_...