Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

JsonDecode retrieving a table?

Asked by
rootx 15
10 years ago

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
What do you expect the "actual decoded JSON" to be? Articulating 1335 — 10y

1 answer

Log in to vote
1
Answered by
MrNicNac 855 Moderation Voter
10 years ago

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

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

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 rootx 15 — 10y
0
I really don't know what you expect it to do. It does it right. MrNicNac 855 — 10y
0
The output is {"id":"1","username":"rootx","password":"6b04a537f690f38b0e61a9874c96271c","money":"100","apikey":"","type":"admin","banned":"0"} rootx 15 — 10y
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. User#2 0 — 10y
Ad

Answer this question