Hello everyone,
I am real stuck with this problem I have decoding. I am not able to grab the field data.user.name (Ricardo Perez). I would like to traverse all the records and print the score and print the name.
For example in this case, I would like to print out:
Ricardo Perez 4
Ricardo Trejo 1
local response = json.decode( event.response )
local data = response.data
{“data”:[{“user”:{“id”:“1128320353850043”,“name”:" Ricardo Perez"},“score”: 4 ,“application”:{“name”:“Speed Up”,“namespace”:“speed_up”,“id”:“1499332987024338”}},{“user{“id”:“1499332987033338”,“name”:” Ricardo Trejo"},“score”: 1 ,“application”:{“name”:“speed Up”,“namespace”:“speed_up”,“id”:"
1499332987033338"}}]}
I am able to grab score like this, but I have tried everything to grab only the name but no luck. Please help, it would be greatly appreciated. Ricardo
for i=1,#data do
if data[i].score then print( "Top Score: " … data[i].score ) end
end