Requesting JSON information from API. Corona

南楼画角 提交于 2019-11-29 17:15:53

here's a sample code to decode the json data i just happen to make a json text file out if the link you gave and decode it hope it helps

local json = require "json"
local txt
local path = system.pathForFile( "json.txt", system.ResourceDirectory )

local file = io.open( path, "r" )
for line in file:lines() do
txt = line
end
print(txt)
local t = json.decode( txt )
print(t["pool_name"])
print(t["hashrate"])
print(t["workers"])
print(t["share_this_round"])
print(t["last_block"])
print(t["network_hashrate"])
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!