Can't parse JSON (JSON is valid)

Hi, Im trying to get data from my gist with http service however it throws an error that it cant parse JSON I checked the file with a JSON validator and it still doesnt work.

JSON:
{"firstName":"John","lastName":"Doe","name":null,"age":40}

Script:

local headers = {
	["Authorization"] = `Bearer {AUTH}`
}

local data = {}

local getRequest = HttpService:GetAsync(URL, false, headers)

data = HttpService:JSONDecode(getRequest)

print(data)
1 Like

I think you aren’t parsing the HTTP response correctly, can you do print(getRequest)?

It doesnt work i tried that 1st

1 Like

Well every API responds to GET requests differently so there’s no way of knowing how to parse it without taking a look at it first

1 Like

Just realized i pasted the page link instead of raw link

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.