Forum Discussion

vivekk0312's avatar
vivekk0312
New Member
6 years ago
Solved

Read an item in the List object in a table column

Hi,

 

I have list object with value as in one of the column in a table. I would like to fetch the item in the list where key is "isproduction" and i want to read the value of the "value" property i,e, true / false

 

[
{
"key": "teamprojecturl",
"value": "https://XXXXXXXX/xxxxxxx"
},
{
"key": "remarks",
"value": "Nice move"
},
{
"key": "isproduction",
"value": "true"
},
{
"key": "organizationalgroupname",
"value": "XXXXX-XXXXXXXX"
},
{
"key": "applicationci",
"value": "XXXXXXXXXXXXXXX"
},
{
"key": "region",
"value": "global"
},
{
"key": "requestedby",
"value": "[email protected]"
}
]

 

 

Thanks,

Vivek Kumar

  • Hi vivekk0312 , 

    You could expand the list and filter it like below

    let
        Source = Json.Document(File.Contents("C:\Users\<username>\Desktop\gantt.json")),
        #"Converted to Table" = Record.ToTable(Source),
        #"Expanded Value" = Table.ExpandListColumn(#"Converted to Table", "Value"),
        #"Expanded Value1" = Table.ExpandRecordColumn(#"Expanded Value", "Value", {"key", "value"}, {"key", "value.1"}),
        #"Filtered Rows" = Table.SelectRows(#"Expanded Value1", each ([key] = "isproduction"))
    in
        #"Filtered Rows"

     

    Best Regards,
    Zoe Zhi

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

1 Reply

  • dax's avatar
    dax
    Icon for Community Support rankCommunity Support

    Hi vivekk0312 , 

    You could expand the list and filter it like below

    let
        Source = Json.Document(File.Contents("C:\Users\<username>\Desktop\gantt.json")),
        #"Converted to Table" = Record.ToTable(Source),
        #"Expanded Value" = Table.ExpandListColumn(#"Converted to Table", "Value"),
        #"Expanded Value1" = Table.ExpandRecordColumn(#"Expanded Value", "Value", {"key", "value"}, {"key", "value.1"}),
        #"Filtered Rows" = Table.SelectRows(#"Expanded Value1", each ([key] = "isproduction"))
    in
        #"Filtered Rows"

     

    Best Regards,
    Zoe Zhi

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.