Parse API result

Hello, I do not know how to parse an API after I have called it with nightbot.

Code:

Blockquote $(urlfetch https://api.chess.com/pub/player/erik/stats)

I want to return the “chess_rapid”:{“last”{“rating”: value but do not know how to parse the API after it has been called. I belive I have to use $(eval) but do not know where to go from there.

The data is in JSON format. The command below outputs the last rapid chess rating.

$(eval JSON.parse(decodeURIComponent(`$(querystring $(urlfetch json https://api.chess.com/pub/player/erik/stats))`)).chess_rapid.last.rating||`Error!`)

Thank you so much that’s perfect

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