Is there a sense to use JSONEncode() function

i’ve seen some developers use HttpService:JSONEncode() function in datastores
like this:

local datastore = game:GetService("DataStoreService")
local pe = datastore:GetDataStore("data")

local success, err = pcall(function()
        local data = game.HttpService:JSONEncode() -- player data
		return pe:SetAsync(plr.UserId, data)
	end)
end)

is there really any sense to use JSONEncode in datastores?

Yes, it is quite useful in certain cases. like storing complex data and that the data format is consistent when saving and receiving from the datastore. This can help avoiding data corruption.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.