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

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

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
    },

5 comments

0

This error means that the string is not in a valid JSON format and cannot be processed into a table.

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.

1

There's an online tool for checking the validity of your JSON string. You can check it out here: https://jsonlint.com/

0

the script is over 2k lines long, just loads of values and stuff

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?

2 answers

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.

1 comment

0

He's clearly trying to decode a string. See the two brackets?

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