gpt4 book ai didi

azure - 如何将 JSON 对象数组转换为 Kusto 表?

转载 作者:行者123 更新时间:2023-12-04 00:28:01 26 4
gpt4 key购买 nike

我有一个从服务器获取的 JSON 架构,我需要将此 JSON 转换为日志分析查询语言表,并使用该表与另一个表进行联接。

JSON 具有以下架构:

[{
"X": "xyz",
"Y": "xyz",
"Z": "xyz",
"prop1": "value1",
"prop2": "value2",
"prop3": "value3"
}, {
"X": "xyz",
"Y": "xyz",
"Z": "xyz",
"prop1": "value1",
"prop2": "value2",
"prop3": "value3"
}]

我试过这个:

let table = todynamic('[{
"X": "xyz",
"Y": "xyz",
"Z": "xyz",
"prop1": "value1",
"prop2": "value2",
"prop3": "value3"
}, {
"X": "xyz",
"Y": "xyz",
"Z": "xyz",
"prop1": "value1",
"prop2": "value2",
"prop3": "value3"
]');

但这不会将 JSON 转换为可用于与其他表联接的内容。

任何帮助将不胜感激。

最佳答案

尝试使用printdynamic:

print myDynamicValue = dynamic([{
"X": "xyz",
"Y": "xyz",
"Z": "xyz",
"prop1": "value1",
"prop2": "value2",
"prop3": "value3"
}, {
"X": "xyz",
"Y": "xyz",
"Z": "xyz",
"prop1": "value1",
"prop2": "value2",
"prop3": "value3"
}])
| mvexpand myDynamicValue // this line is just an example

更新(基于评论中的问题):

let result = 
print myDynamicValue = dynamic(
[
{ "X": "xyz", "Y": "xyz", "Z": "xyz", "prop1": "value1", "prop2": "value2", "prop3": "value3" },
{ "X": "xyz", "Y": "xyz", "Z": "xyz", "prop1": "value1", "prop2": "value2", "prop3": "value3" }
])
| mvexpand myDynamicValue
| evaluate bag_unpack(myDynamicValue);
result

关于azure - 如何将 JSON 对象数组转换为 Kusto 表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54746111/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com