Monday, 24 April 2017

Node.js get specific keys+values out of big JSON String

I got a question about JSONStream. This is my code.

        var neUrl = "https://euw.api.riotgames.com/api/lol/euw/v2.5/league/by-summoner/someid?api_key="+my_api_key;

        https.get(neUrl, function(response) {
                //response is a realy big json string
                //JSON.parse not parsing everything
                //want to stream the response and search for a specific 
                //key to get the value
        });

How am i able to access the value of a specific key.

response looks like this:

    {
    "someid": [
    {
    "name": "somename",
    "tier": "sometier",
    "queue": "someque",
    "entries": [
    {
"playerOrTeamId": "someid",
"playerOrTeamName": "somename",
"division": "somediv",
"leaguePoints": somepoints,
"wins": somewins,
"losses": somelosses,
"isHotStreak": someboolean,
"isVeteran": someboolean,
"isFreshBlood": someboolean,
"isInactive": someboolean
},
{},
//hundreds of more objects...

I want to get the value of "tier" + "queue" + "playerOrTeamId" etc.

Im trying hard with JSONStream etc. for hours but i still got no solution for this.

Anyone can Help?

Thanks a lot

Chzn



via chzn

No comments:

Post a Comment