I want to Parse this code
{
"users":{
"1994595371":{
"reason": "test"
"duration": -1
},
"550996845":{
"reason": "loser"
},
}
}
Im getting the information from a github file but i get this error
“Can’t parse JSON”
Are you sure raw.githubusercontent.com
is the correct URL?
Be sure to copy the exact URL where the JSON is located.
azqjanna
(azqjanna)
June 4, 2025, 9:25pm
3
That’s not legal JSON. It should look like this:
{
"users":{
"1994595371":{
"reason": "test",
"duration": -1
},
"550996845":{
"reason": "loser"
}
}
}
(The commas are different)
I just removed my full url for private reasons
Okay that works but if i want to find out if the userID is in the list it doenst find it and prints out nil
Players.PlayerAdded:Connect(function(Player)
local Playerfound = table.find(Users, Player.UserId)
print(Playerfound)
print(Users[Player.UserId])
if table.find(Users, Player.UserId) then
PlayerEvent:FireClient()
end
end)
azqjanna
(azqjanna)
June 5, 2025, 1:52pm
6
You need to look for a string not a number: tostring(Player.UserId)
azqjanna
(azqjanna)
June 5, 2025, 1:53pm
7
Table.find is also wrong if I understand your use case correctly. It finds based on the value not the key.
What should i use then? because i had a same script a long time ago and a person here told me to use table.find
azqjanna
(azqjanna)
June 5, 2025, 1:56pm
9
If “1994595371” is a user id, you need to get it using:
Users[tostring(Player.UserId)]
That will give you {"reason": "test", "duration": -1}
1 Like
Okay thanks. Yeah i already found out . Thank you very much!