How to update the value of object

Options

Hello, ran into a strange issue while using an external API,

{
"id": 1,
"lat": 55.082226,
"lng": 22.76919399999946,
"rank": 2
},
{
"id": 2,
"lat": 55.082226,
"lng": 22.76919399999946,
"rank": false
}

This is the response that I get, and in my database, I have 'rank' field as an integer.

Is there a way to replace those objects that have
"rank": false

to "rank" : 1

Thank you 🙌

Answers

  • Pawel Magdanski
    Pawel Magdanski Member ✭✭✭
    Options

    Hi,

    as a quick solution you can create a loop through that list and inside the loop create a conditional that will check if the "rank" in current item is false. If true then you can use "update variable" function pick item and update rank path, setting value to 1.

    Hope that helps, if you have any issues please let me know.