解析 Kusto 列中的嵌套 JSON 数据
Parsing nested JSON data within a Kusto column
在使用 parse_json 解析我的 Kusto 集群中一列中的 JSON 数据后,我注意到结果预测值中嵌套了更多 JSON 格式的数据.我需要访问该信息并使 JSON 数据的每一部分都成为自己的列。
我已尝试遵循此 SO post (Parsing json in kusto query) 的答案,但未能成功获得正确的语法。
myTable
| project
Time,
myColumnParsedJSON = parse_json(column)
| project myColumnParsedNestedJSON = parse_json(myColumnParsedJSON.nestedJSONDataKey)
我希望结果是投影列,每个列都被命名为每个键,它们各自的值显示在一行记录中。
请参阅 this 文档底部的注释:
It is somewhat common to have a JSON string describing a property bag in which one of the "slots" is another JSON string. In such cases, it is not only necessary to invoke parse_json
twice, but also to make sure that in the second call, tostring
will be used. Otherwise, the second call to parse_json
will simply pass-on the input to the output as-is, because its declared type is dynamic
一旦您能够 parse_json
正确解析您的有效负载,您可以使用 bag_unpack
插件 (doc) 来实现您提到的这个要求:
I expect the results to be projected columns, each named as each of the keys, with their respective values displayed in one row record.
在使用 parse_json 解析我的 Kusto 集群中一列中的 JSON 数据后,我注意到结果预测值中嵌套了更多 JSON 格式的数据.我需要访问该信息并使 JSON 数据的每一部分都成为自己的列。
我已尝试遵循此 SO post (Parsing json in kusto query) 的答案,但未能成功获得正确的语法。
myTable
| project
Time,
myColumnParsedJSON = parse_json(column)
| project myColumnParsedNestedJSON = parse_json(myColumnParsedJSON.nestedJSONDataKey)
我希望结果是投影列,每个列都被命名为每个键,它们各自的值显示在一行记录中。
请参阅 this 文档底部的注释:
It is somewhat common to have a JSON string describing a property bag in which one of the "slots" is another JSON string. In such cases, it is not only necessary to invoke
parse_json
twice, but also to make sure that in the second call,tostring
will be used. Otherwise, the second call toparse_json
will simply pass-on the input to the output as-is, because its declared type isdynamic
一旦您能够 parse_json
正确解析您的有效负载,您可以使用 bag_unpack
插件 (doc) 来实现您提到的这个要求:
I expect the results to be projected columns, each named as each of the keys, with their respective values displayed in one row record.