In a data store I don't understand why I would Encode and Decode a table when roblox already did it for us is there any benefit to doing so?
COMMUNITY QUESTION
What is the purpose of JSON encoding a table and decoding it I thought roblox did that for us?
1 answer
You can't save a string with a size larger than 260,000 characters for a single key, so one may want to check the size of their JSON encoded table before saving it. For example:
local t = {}
for i = 1, 2^14 do
t[i] = true
end
local json_t = HttpService:JSONEncode(t)
if #json_t > 260000 then
-- handle error
else
data:SetAsync("test", t)
end
There is no other major reason that you should care about encoding your datum to JSON before saving it unless you need to check something before the save occurs.
This discussion is preserved as it was. New answers, comments, and votes are closed.
