[Ruby]jsonを出力する
jsonを出力する
#coding:utf-8 require 'json' print("Content-type: application/json\n\n") print JSON.generate({"time"=>Time.now.strftime("%Y-%m-%d %H:%M:%S"), "user"=>[ {"id" => 32, "name"=>"jeff"}, {"id" => 56, "name"=>"john"} ] })
jsonを出力する
#coding:utf-8 require 'json' print("Content-type: application/json\n\n") print JSON.generate({"time"=>Time.now.strftime("%Y-%m-%d %H:%M:%S"), "user"=>[ {"id" => 32, "name"=>"jeff"}, {"id" => 56, "name"=>"john"} ] })