Legacy Dev Forum Posts

 View Only

Sign Up

Using powershell, how do I use select-object when top level isn't an array?

  • 1.  Using powershell, how do I use select-object when top level isn't an array?

    Posted 06-05-2025 19:34

    VaunMcCarthy | 2023-04-08 09:20:55 UTC | #1

    Not sure why I can't figure this out - should be simple.

    Example JSON:

    { "entities": [ { "id": "1377fe63-e89a-4da9-bfe1-7d9a3e885624", "user": {}, "client": { "id": "" } ....

    I want to select just the "id" item there for each entry in the entities array.

    Can someone please help me with how the Select-Object should be formed to do this please?


    Jerome.Saint-Marc | 2023-04-11 08:23:48 UTC | #2

    Hello,

    I don't have a windows OS so I can't answer/test myself. But @anon28885283 wrote a good blog a while ago on using powershell with Genesys Cloud CLI. There are some powershell examples available in the Genesys Cloud CLI Recipes.

    Regards,


    Declan_ginty | 2023-04-11 09:56:55 UTC | #3

    Hi,

    I'm not hugely familiar with powershell but something like this command might help

    gc.exe outbound callabletimesets list | ConvertFrom-Json | Select-Object -ExpandProperty entities | Select-Object -ExpandProperty id

    Here I am printing the id's of all the callabletimesets returned. Hope this is what you need.

    Regards, Declan


    VaunMcCarthy | 2023-04-11 10:15:51 UTC | #4

    Thanks Declan that was a huge help and got me on the right track.


    system | 2023-05-11 10:16:25 UTC | #5

    This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 19365