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

How to convert a StringValue Value to Table using JSONDecode?

So I have a StringValue in the Workspace that has the Value {"Dog","Brown",5} And my script is:

HS = game:GetService("HttpService")

local Tab = HS:JSONDecode(game.Workspace.StringValue.Value)
print(Tab[1])

But I get the error "Can't parse JSON". What am I doing wrong?

3 comments

0

thats probarly cuz it only accepts json, and ur trying a string

0

So should I first encode, then decode? Or should I just make a JSON Table?

1 answer

Figured it out, It needs to be a JSON table instead of LUA, so just use [] instead of {}

1 comment

0

Yes... to decode JSON you need JSON... feel free to close the question

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