脳汁portal

アメリカ在住(だった)新米エンジニアがその日学んだIT知識を書き綴るブログ

2016-12-02から1日間の記事一覧

sinatraでhashデータをJSONとして返す方法

方法 require 'json' return #{hash}.to_json 例 require 'sinatra' require 'json' get '/top' do hash = { "key1" => 1, "key2" => 2, "key3" => 3, } return hash.to_json end