JSONDecode not working?

Hello, when I run this code:

local get_is_favorited = Proxy:Get('https://games.roblox.com/v1/games/'..universeId..'/votes/user')
	local is_favorited = game.HttpService:JSONDecode(get_is_favorited.body)
	favorites = (comma_value(favorite_stats.favoritesCount))
	favorited = is_favorited.userVote

and then print ‘is_favorited’, it returns as: table: 0x2de73c66d307c834

It should return as this: https://games.roblox.com/v1/games/2215845151/votes/user
I am pretty sure I am making a rookie mistake, so please correct me if you can!

Proxy:Get('https://games.roblox.com/v1/games/'..universeId..'/votes/user').body --you forgot .body

I did it here though, that shouldn’t make a difference, right?

JSONDecode converts a string into a Lua table. What you are doing is printing a lua table, which will print the memory address I believe. You need to use JSONEncode to print it - that will return a stringified version of the table for you to print.

Alright, I tried printed it again and it came out as this:

{"errors":[{"code":0,"message":"Authorization has been denied for this request."}]} 

Probably because of a cookies issue?

This is unrelated to JSONDecode or JSONEncode

You are correct - you need to be signed in to access that API endpoint

1 Like

your doing .body before you ever decode the json. Try agian but do .body outside of the function.

Also the fact is that you need a valid roblo security for this function. It’s impossible to tell unless you give the cookie.(this cookie is dangerous and can lead to you or someone else’s account being hacked if someone gets it.)

Alright, I’ll do these things tomorrow once I have time, thanks for the time.

There is nothing you can do. Unless your going to ask the user for their roblo security cookie(agiasnt the rules) then it’s impossible. You also would need a proxy server for the roblox api access. In simple terms it’s impossible.

What is your goal? You aren’t allowed to use the API to find out if a certain player has voted. The best you can do is get the total upvote count.