るりまサーチ

最速Rubyリファレンスマニュアル検索!
24件ヒット [1-24件を表示] (0.123秒)
トップページ > クエリ:C[x] > 種類:インスタンスメソッド[x] > クエリ:method[x] > モジュール:JSON::Generator::GeneratorMethods::String[x]

別のキーワード

  1. _builtin to_c
  2. etc sc_2_c_dev
  3. etc sc_2_c_bind
  4. tracer display_c_call
  5. tracer display_c_call=

ライブラリ

キーワード

検索結果

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

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

...する場合に使用してください。

require 'json'
"にほんご".encode("euc-jp").to_json_raw_object
# => {"json_class"=>"String", "raw"=>[164, 203, 164, 219, 164, 243, 164, 180]}
"にほんご".encode("euc-jp").to_json # source sequence is illegal/malformed (JSON::GeneratorError)...

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

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

...指定します。

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

puts "test".to_json # => "test"
puts '"'.to_json # => "\""
puts "\\".to_json # => "\\"
puts "𤘩宮城".to_json(ascii_only: true) # => "\ud851\ude29\u5bae\u57ce"
//}...