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
时间: 2024-09-30 19:27:12