Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Using JSON to Decode and Encode tables?

Im saving tables and have done so by encoding and decoding them.

I am using

local hs = game:GetService("HttpService") local balloons = hs:JSONEncode(table)

But when I do that, I get an error: Can't parse JSON

2 comments

0

is table nil?

0

What is table? We can't exactly help you without knowing that.

1 answer

print (game.HttpService:JSONEncode({["Gold"]=25,["XP"]=50}))

{"Gold":25,"XP":50}

print (game.HttpService:JSONDecode('{"Gold":25,"XP":50}')) 

table

print (game.HttpService:JSONDecode('{"Gold":25,"XP":50}')["Gold"])

25

This discussion is preserved as it was. New answers, comments, and votes are closed.