0

我正在尝试在 Azure Sentinel 的工作簿中构建仪表板。其中一列是不同长度的 JSON 数组。我想拆分该数组,以便数组中的每个元素都成为自己的列,但我想不出一个好方法来做到这一点。基本上我想要这个

-----------------------------------
Company | products
-----------------------------------
Apple     | [iMac, iPhone, iPad]
Microsoft | [xBox, xBox 360]
Google    | [Chromebook]
--------------------------------------

成为

-----------------------------------
Company | product_1 | product_2 | product_3
-----------------------------------
Apple | iMac        |iPhone     |iPad
Microsoft | xBox    |xBox 360   |
Google | Chromebook |           |
--------------------------------------

4

1 回答 1

3

效率不高,但这里有一个选择:

datatable(company:string, products:dynamic)
[
    "Apple",     dynamic(['iMac', 'iPhone', 'iPad']),
    "Microsoft", dynamic(['xBox', 'xBox 360']),
    "Google",    dynamic(['Chromebook']),
]
| mv-apply with_itemindex=i products on (
    extend p = pack(strcat("product_", i+1), products)
    | summarize b = make_bag(p)
)
| evaluate bag_unpack(b)
| project-reorder company, product* asc

-->

| company   | product_1  | product_2 | product_3 |
|-----------|------------|-----------|-----------|
| Apple     | iMac       | iPhone    | iPad      |
| Microsoft | xBox       | xBox 360  |           |
| Google    | Chromebook |           |           |
于 2021-01-27T01:52:34.450 回答