您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

从API请求JSON信息。电晕

从API请求JSON信息。电晕

这是一个示例代码,用于解码json数据,如果您提供的链接可以解码,我恰好可以制作一个json文本文件并对其进行解码,希望对您有所帮助

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"])
其他 2022/1/1 18:13:53 有497人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶