るりまサーチ (Ruby 2.6.0)

最速Rubyリファレンスマニュアル検索!
2件ヒット [1-2件を表示] (0.076秒)
トップページ > バージョン:2.6.0[x] > クエリ:String[x] > クエリ:to[x] > クエリ:json_create[x]

別のキーワード

  1. _builtin to_s
  2. openssl to_der
  3. openssl to_s
  4. _builtin to_a
  5. openssl to_pem

ライブラリ

検索結果

JSON::Generator::GeneratorMethods::String::Extend.json_create(hash) -> String (81643.0)

JSON のオブジェクトから Ruby の文字列を生成して返します。

JSON のオブジェクトから Ruby の文字列を生成して返します。

@param hash キーとして "raw" という文字列を持ち、その値として数値の配列を持つハッシュを指定します。

require 'json'
String.json_create({"raw" => [0x41, 0x42, 0x43]}) # => "ABC"

JSON.create_id -> String (406.0)

json_create メソッドで使用するクラスを決定するために使用する値を返します。

json_create メソッドで使用するクラスを決定するために使用する値を返します。

デフォルトは "json_class" です。

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

class User
attr :id, :name
def initialize(id, name)
@id, @name = id, name
end

def self.json_create(object)
new(object['id'], object["name"])
end

def as_json(*)
{
...