Hello!
Recently I’ve been trying to convert my whole map into a JSON. So I can try making a map builder that you only need a single string for. But with this comes a problem; when I convert the Table Data to a json, THE STRING IS 2,000,000 MILLION CHARACTERS LONG! I can’t put this string anywhere or studio crashes/errors! When it doesn’t crash, I get an error that reads: string too long
So far, I’ve tried to shorten the RequiredToAdd table to remove some properties, and it still comes out as a VERY high number! I’ve searched through the dev-forum too to see if I could paste it anywhere, and even tried PostAsync to see if that would work. It turns out the text is about 2 whole megabytes! If you can improve my code to fix this, please let me know, thanks!
local Parts = {}
local DATA = {}
local RequiredToAdd = {
'Shape';
'ClassName';
'CFrame';
'Size';
'CanCollide';
'Transparency';
'Color';
'Material';
'Anchored';
'CastShadow';
'Massless';
'Reflectance';
}
for ppp, instance in ipairs(workspace:GetDescendants()) do
if instance:IsA('BasePart') and not (instance:IsA('Terrain') or instance:IsA('UnionOperation')) then
if not (instance:IsA('Terrain')) then
local CurrentItemInList = #DATA+1
DATA[CurrentItemInList] = {}
local NewTable = DATA[CurrentItemInList]
if instance:IsA('MeshPart') then
NewTable.MeshId = instance.MeshId
end
for _, Variation in ipairs(RequiredToAdd) do
if not (Variation == 'Shape' and (instance:IsA('MeshPart') or instance:IsA('WedgePart') or instance:IsA('CornerWedgePart') or instance:IsA('TrussPart') or instance:IsA('TriangleMeshPart'))) then
NewTable[Variation] = instance[Variation]
end
end
end
end
warn('step done : ', ppp)
end
warn('nani???')
local inf = game.HttpService:JSONEncode(DATA)
warn('DONE :D', inf:len())
If you can help me, I would be very grateful!
Thank you!