JSONEnocde is definitely the better option but if you want, here is a function I wrote. (untested and written on mobile so there could be typos)
local function serialize(data)
local strData = ""
for i, v in pairs(data) do
strData.Value = strData.Value.."["..i.."] = "..data..", "
end
return strData
end
local function deserialize(strData)
local data = {}
for i, v in pairs(strData:split(", ")) do
local idx = v:split(" = ")[1]
local val = v:split(" = ")[2]
data[idx] = val
end
return data
end