るりまサーチ

最速Rubyリファレンスマニュアル検索!
24件ヒット [1-24件を表示] (0.015秒)
トップページ > クエリ:require[x] > モジュール:JSON::Generator::GeneratorMethods::String[x]

別のキーワード

  1. kernel require
  2. getoptlong require_order
  3. rubygems/custom_require require
  4. irb/ext/use-loader irb_require
  5. require execute

ライブラリ

キーワード

検索結果

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

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

...スタンスか、
JSON::State.new の引数と同じ Hash を
指定します。

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

puts "test".to_json # => "test"
puts '"'.to_json # => "\""
puts "\\".to_json...

JSON::Generator::GeneratorMethods::String#to_json_raw_object -> Hash (7.0)

生の文字列を格納したハッシュを生成します。

...成します。

このメソッドは UTF-8 の文字列ではなく生の文字列を JSON に変換する場合に使用してください。

require
'json'
"にほんご".encode("euc-jp").to_json_raw_object
# => {"json_class"=>"String", "raw"=>[164, 203, 164, 219, 164, 243, 164, 180]}
"...