json 转 hash(MultiJson)

require ‘multi_json‘

MultiJson.load(‘{"abc":"def"}‘) #=> {"abc" => "def"}
MultiJson.load(‘{"abc":"def"}‘, :symbolize_keys => true) #=> {:abc => "def"}
MultiJson.dump({:abc => ‘def‘}) # convert Ruby back to JSON
MultiJson.dump({:abc => ‘def‘}, :pretty => true) # encoded in a pretty form (if supported by the coder)
MultiJson.load(MultiJson.dump({:abc => ‘def‘}),:symbolize_keys => true)

json 转 hash(MultiJson),布布扣,bubuko.com

json 转 hash(MultiJson)

上一篇:js 刷新页面


下一篇:模态对话框 bootstrap-modal.js