1

I am attempting to get a value from a JSON reply from an API in Node.js. The basics of the reply is

{
    "data": {
        "type": "playerSeason",
        "attributes": {
            "gameModeStats": {
                "duo": {
                    ...
                },
                "duo-fpp": {
                    ...
                }
            }
        }
    }
}

Imagine that there is actually the right number of closing brackets and everything lines up as it should.

I am currently using

    let data=body.data.attributes.gameModeStats;
    let duos=data.duo;
    let duo_fpp=data.duo-fpp;

but data.duo-fpp appears as subtracting fpp from data.duo.

How do I appropriately reference data.duo-fpp?

Eralper
  • 6,461
  • 2
  • 21
  • 27

0 Answers0