るりまサーチ

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

別のキーワード

  1. メソッド呼び出し(super・ブロック付き・yield)
  2. メソッド呼び出し(super・ブロック付き・yield) proc
  3. メソッド呼び出し(super・ブロック付き・yield) method
  4. メソッド呼び出し(super・ブロック付き・yield) localjumperror

ライブラリ

検索結果

JSON::Generator::GeneratorMethods::Object#to_json(state_or_hash = nil) -> String (19.0)

自身を to_s で文字列にした結果を JSON 形式の文字列に変換して返します。

...JSON::State.new の引数と同じ Hash を
指定します。

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

class
Person
attr :name, :age

def initialize(name, age)
@name, @age = name, age
end
end

tanaka = Person.new("tanaka", 29)

tanaka.to_json # => "...