I’m encountering an issue in my Roblox script, and I could really use some assistance. I keep getting a “Can’t parse JSON” error, and despite trying various solutions, I haven’t been able to resolve it, I want it to print in a table form.
I’ve tried various methods, but the “Can’t parse JSON” error persists. If anyone can help me identify the issue and provide a solution, I would greatly appreciate it.
Hey! We can help you better if you can provide us with the actual Table that you’re trying to parse. (response). print(response) instead of trying to decode it directly and show us
If this is your API you’re using, check you’re correctly structuring your JSON payload. Perhaps put it through a JSONIFY function (dependant on which back-end language you’re using).
local HttpService = game:GetService("HttpService")
local apiUrl = "https://exclude-reward-planners-arthur.trycloudflare.com/redv2"
local success, response = pcall(function()
return HttpService:GetAsync(apiUrl)
end)
if success then
response = response:gsub(']%s*%[', ', ')
local jsonData = HttpService:JSONDecode(response)
end
Yes?.. why do you ask? I’ve done that for sending requests on my own APIs in the past for sure. Encoding to send to the server to save and Decoding data received from it.