local json = require ("dkjson")
local https = require("ssl.https")
local url = "https://masa.dy.fi/~masa/testailu/mc_stats_dev/dev_json.php?type=server_status"
local response, error = https.request(url)

local obj, pos, err = json.decode (response, 1, nil)

local text = ""
for k, v in pairs(obj) do
  text = text .. v.status .. "\t"
  text = text .. v.version .. "\t"
  text = text .. v.num_players .. "\t"
  text = text .. v.server_name .. "\t"
  text = text .. "\n"
  if v.players then
    for i, p in pairs(v.players) do
      text = text .. '\t\t' .. p .. '\n'
    end
  end
end

print(text)

