我從JSON檢索數據,但整個數據顯示在我的頁面上, 但我想明智地顯示它,例如。第一頁1到10, 和當用戶按下按鈕,其餘的記錄顯示,我工作 那,但不能解決它,是否有任何概念的電暈, 或請提供對於這個問題,感謝幫助..在日冕顯示JSON數據頁明智
這裏是我的JSON數據結構:
My code for displaying JSON data:
local test=json.decode(event.response)
local datas=test.data
for name, users in pairs(datas) do
for names, usernames in pairs(users) do
for tag,value in pairs(usernames) do
cid=value.customerid
cname=value.customername
print(cname)
print(cid)
end
end
end
這是要顯示明智頁的json數據
{
"status":"success",
"data":{
"marks":[
{
"Marks":{
"first_name":"Amit",
"last_name":"Sharma",
"country_id":"20",
"Physics":"50",
"Chemistry":"35",
"Mathematics":"40"
}
},
{
"Marks":{
"first_name":"Amit",
"last_name":"Yadav",
"country_id":"21",
"Physics":"50",
"Chemistry":"35",
"Mathematics":"40"
}
},
{
"Marks":{
"first_name":"Pankaj",
"last_name":"Shukla",
"country_id":"22",
"Physics":"50",
"Chemistry":"35",
"Mathematics":"40"
}
},
{
"Marks":{
"first_name":"Abhishek",
"last_name":"Tiwari",
"country_id":"25",
"Physics":"50",
"Chemistry":"35",
"Mathematics":"40"
}
},
{
"Marks":{
"first_name":"Kashif",
"last_name":"Khan",
"country_id":"20",
"Physics":"50",
"Chemistry":"35",
"Mathematics":"40"
}
},
{
"Marks":{
"first_name":"Ankit",
"last_name":"Sharma",
"country_id":"19",
"Physics":"50",
"Chemistry":"35",
"Mathematics":"40"
}
},
{
"Marks":{
"first_name":"Rahul",
"last_name":"Vishwakarma",
"country_id":"27",
"Physics":"50",
"Chemistry":"35",
"Mathematics":"40"
}
},
{
"Marks":{
"first_name":"Amit",
"last_name":"Tiwari",
"country_id":"30",
"Physics":"50",
"Chemistry":"35",
"Mathematics":"40"
}
},
{
"Marks":{
"first_name":"Amit",
"last_name":"Sharma",
"country_id":"78",
"Physics":"50",
"Chemistry":"35",
"Mathematics":"40"
}
},
{
"Marks":{
"first_name":"Amit",
"last_name":"Sharma",
"country_id":"23",
"Physics":"50",
"Chemistry":"35",
"Mathematics":"40"
}
}
]
}
}
你爲什麼不只是循環它由10而不是環路,所有 – DevfaR
能否請您給我一些暗示我怎麼可以在這裏使用循環。 – dk3611
你能提供你的json數據的鏈接 – DevfaR