class JSONServlet
def do_GET(req, res)
def do_GET(req, res) obj = { "TIME" => Time.now.strftime("%FT%T"), "foo" => "Bär", "bar" => "© ≠ €!", 'a' => 2, 'b' => 3.141, 'COUNT' => @@count += 1, 'c' => 'c', 'd' => [ 1, "b", 3.14 ], 'e' => { 'foo' => 'bar' }, 'g' => "松本行弘", 'h' => 1000.0, 'i' => 0.001, 'j' => "\xf0\xa0\x80\x81", } res.body = JSON.generate obj res['Content-Type'] = "application/json" end
def do_GET(req, res)
def do_GET(req, res) obj = { "TIME" => Time.now.strftime("%FT%T"), "foo" => "Bär", "bar" => "© ≠ €!", 'a' => 2, 'b' => 3.141, 'COUNT' => @@count += 1, 'c' => 'c', 'd' => [ 1, "b", 3.14 ], 'e' => { 'foo' => 'bar' }, 'g' => "松本行弘", 'h' => 1000.0, 'i' => 0.001, 'j' => "\xf0\xa0\x80\x81", } res.body = JSON.generate obj res['Content-Type'] = "application/json" end