Friday, 21 April 2017

How do you update an array value in JSON

JSON Data:

{
  "id": 68,
  "username": "lol",
  "rank_elo": 1500,
  "role": [
    "Jungle",
    "Mid"
  ],
  "total_wins": 0,
  "most_played": "Default",
  "discord_id": 255942245242409472,
  "summoner_id": 20277668,
  "coins": 0
}

I have a question, how come this works?

request({uri: uri, method: "PATCH", json: {"total_wins": 1}});

But then when I try to run this, it doesn't work?

request({uri: uri, method: "PATCH", json: {"role": ["Support", "Top"]});

What do I have to do to get the array to patch?



via Eric Chu

No comments:

Post a Comment