Object to Array

Options
I have 2 query in my API.
The first API will return results in object
{"id":1,"id":2,"id":3}

how can I turn these into an array so that I can use it on my next query to exclude? I assume I need to use subpath, but I can't loop each with something like results.*.id

Comments

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
    Can you clarify? {"id":1,"id":2,"id":3} as an object is not valid because it has the same path. 
    Is it perhaps: 
    [{"id":1},{"id":2},{"id":3}]

    And what are you trying to transform it into? Just the values?
    [1,2,3]?
  • Knight
    Knight Member
    Options
     you are right on the objects, yes just the values, so that I can use it on my next query , Select * from where id in [1,2,3]
  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
    So you can use the VALUES filter if you want to just grab the values of an object. There's a tutorial on it too

    
  • Knight
    Knight Member
    Options
    that's a bit diff, I have object of array
    [{"hidden_chat_token":"user2"},{"hidden_chat_token":"user3"}]
    but I need it to convert into array ["user2","user3]
  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
    I see... so I would just create a new variable, name it whatever you want and just use dot notation on the existing variable object to get the results you want:

    [Screenshot_2021-08-17_20-59-58.png]