如何将 JSON 对象数组转换为 Kusto table?
How to transform a JSON array of objects to a Kusto table?
我有一个从服务器获取的 JSON 架构,我需要将此 JSON 转换为日志分析查询语言 table 并使用 table加入另一个 table.
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 转换为可用于与其他 table 连接的内容。
任何帮助将不胜感激。
尝试使用 print
和 dynamic
:
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
我有一个从服务器获取的 JSON 架构,我需要将此 JSON 转换为日志分析查询语言 table 并使用 table加入另一个 table.
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 转换为可用于与其他 table 连接的内容。
任何帮助将不胜感激。
尝试使用 print
和 dynamic
:
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