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

JsonDecode retrieving a table?

Heya! I'm using HTTPService and I have some JSON on my site that id like to retrieve via roblox

SiteAPI.Currency = function(username)
	MasterArg = Settings["MasterArg"]
	Retrieve = hs:GetAsync(Settings["Retrieve"] .. username .. MasterArg)
	RetrieveJSON = hs:JSONDecode(Retrieve)
	--print(Settings["Retrieve"] .. username .. b) --< Uncomment for debugging strings
	print(RetrieveJSON)
end

Ignore the messy code.

However in the output I'm getting a table instead of the actual decoded json?

1 comment

1

What do you expect the "actual decoded JSON" to be?

1 answer

That's...because you're decoding the JSON -.-

Decoded JSON == table. Else it's just a string. Print the 'retrieve' instead.

4 comments

0

I have MasterArg = Settings["MasterArg"] Retrieve = hs:GetAsync(Settings["Retrieve"] .. username .. MasterArg) RetrieveJSON = hs:JSONDecode(Retrieve) --print(Settings["Retrieve"] .. username .. b) --< Uncomment for debugging strings print(Retrieve) and it doesn't decode the json

0

I really don't know what you expect it to do. It does it right.

0

The output is {"id":"1","username":"rootx","password":"6b04a537f690f38b0e61a9874c96271c","money":"100","apikey":"","type":"admin","banned":"0"}

0

Considering the output is a string (in JSON) that means it's not a table, aka it wasn't decoded properly. That usually means you have an error in your JSON syntax.

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