Whenever I decode a JSON table into a Lua table it keeps returning ? {...} which breaks my script because its a invalid JSON table.

Original JSON table

[["ChripCat","You have been banned PERMANENTLY"]]

Server side:

local HTTPServer = "http://127.0.0.1:8079/"

local banlist = HTTPServer.. "banlist.json"

local http = game:GetService("HttpService")

local success,reason = pcall(function()
	bantable = http:GetAsync(banlist)
end)
print(reason)
if success then
	local decoded = http:JSONDecode(bantable)
	print(decoded)
	local players = game:GetService("Players")
	players.PlayerAdded:Connect(function(plr)
		for i = 1, #decoded do
			if plr.Name == decoded[i][1] then
				plr:Kick(decoded[i][2])
			end
		end
	end)
else
	print("Connection failed permbanning failed :(")
end

1 comment

0

Try this, http:JSONEncode(bantable). It should give you the encoded version of the decoded table. Put the encoded into your website and it should work.