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

I keep getting this error JSONDecode error: "Can't parse JSON" - help?

Asked by
Faunx -5
6 years ago

I have this huge script but it doesn't fit on here, the error is on line 5.

-- services
local httpService = game:GetService("HttpService");

-- execution
return httpService:JSONDecode([[
    [
    {
        "AssetId" : 689381514,
        "Name" : "Celtic Necklace of Mystery",
        "AveragePrice" : 475
    },
    {
        "AssetId" : 721555148,
        "Name" : "Dominus Argentum",
        "AveragePrice" : 5666666
    },
0
This error means that the string is not in a valid JSON format and cannot be processed into a table. User#5423 17 — 6y
1
We can find the error in the JSON formatting, but you're gonna have to post the rest of the string. You cut it off at line 16. adark 5487 — 6y
1
There's an online tool for checking the validity of your JSON string. You can check it out here: https://jsonlint.com/ XAXA 1569 — 6y
0
the script is over 2k lines long, just loads of values and stuff Faunx -5 — 6y
0
Is it possible that it's too long? It's unlikely, but if the validator didn't show any errors, maybe you can shorten it and check? XAXA 1569 — 6y

2 answers

Log in to vote
0
Answered by
Faunx -5
6 years ago

Here is the full script, over 9k lines. https://pastebin.com/fsaSxaYc

Ad
Log in to vote
-1
Answered by 6 years ago

A JSON table is a string. You are trying to decode a table in Lua, which is not JSON. Therefore, you cannot decode the Lua table, as it is not a string, nor a JSON table.

0
He's clearly trying to decode a string. See the two brackets? XAXA 1569 — 6y

Answer this question