るりまサーチ

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

別のキーワード

  1. _builtin >
  2. bigdecimal >
  3. module >
  4. integer >
  5. float >

ライブラリ

検索結果

JSON::Generator::GeneratorMethods::String#to_json_raw_object -> Hash (114.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)...