如何将对象的JSON数组转换为Kusto表? [英] How to transform a JSON array of objects to a Kusto table?
本文介绍了如何将对象的JSON数组转换为Kusto表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个从服务器获取的JSON模式,我需要将此JSON转换为日志分析查询语言表,并使用该表与另一个表进行联接.
I have a JSON schema that I get from the server and I need to transform this JSON into a log analytics query language table and use that table to make a join with another table.
JSON具有以下架构:
The JSON has the following schema:
[{
"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转换为可用于与其他表的联接的东西.
But this does not convert the JSON into something that can be used in a join with other tables.
任何帮助将不胜感激.
推荐答案
尝试使用 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数组转换为Kusto表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文