JSON.decodeのサンプル
■ソースコード
require 'active_support'
json = "{\"id\":1,\"name\":\"yoshida\"}"
hash = ActiveSupport::JSON.decode(json)
puts hash
■結果
{ :id => 1, :name => 'yoshida' }
require 'active_support'
json = "{\"id\":1,\"name\":\"yoshida\"}"
hash = ActiveSupport::JSON.decode(json)
puts hash
{ :id => 1, :name => 'yoshida' }
On Your Mark
0 件のコメント:
コメントを投稿