'How can I access this value in an object inside an object from this Api response?

So I'm trying to get the value of faceit_elo that is inside the csgo object I've tried doing data.games.csgo.faceit_elo but it doesn't work. Does anyone have an idea how to get this value? Thank you!

Api Response

My code

Edit: Whenever I try to get the faceit_elo value, or just try to console.log(data.games.csgo), it just says process isn't defined. But when I try to get the value of avatar (data.avatar) there isn't any issue with that. I don't think there is an issue with the code, I just don't know how to access the faceit_elo

Edit: I've figured out the error, it was on the setData(response), I had to change it to setData(response.games.csgo) so I could access the faceit_elo value. This is for react-native. As for a normal javascript app, you just get the value the same as javascript opjects.



Solution 1:[1]

It seems like you're getting the response as a JSON format. Try this:

JSON.parse(data).games.csgo.faceit_elo

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Yogev D.