Kusto 将括号从 JSON 数组删除到列表
Kusto remove bracket from JSON array to a list
我有一个非常简单的问题,但是我似乎找不到答案。
如何转换 json 数组变量
["one","two","three"]
转换成以下适合使用参数进行字符串搜索的格式 ?
"one","two","three"
谢谢智囊团....
您可以使用以下功能:
- substring() - 从索引 1 开始,长度为 strlen()-2:https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/substringfunction; https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/strlenfunction
- strcat_array(): https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/strcat-arrayfunction
例如:
print input = dynamic(["one","two","three"])
| project output1 = substring(input, 1, strlen(input)-2),
output2 = strcat('"', strcat_array(input, '","'), '"')
output1
output2
"one","two","three"
"one","two","three"
我有一个非常简单的问题,但是我似乎找不到答案。 如何转换 json 数组变量
["one","two","three"]
转换成以下适合使用参数进行字符串搜索的格式 ?
"one","two","three"
谢谢智囊团....
您可以使用以下功能:
- substring() - 从索引 1 开始,长度为 strlen()-2:https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/substringfunction; https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/strlenfunction
- strcat_array(): https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/strcat-arrayfunction
例如:
print input = dynamic(["one","two","three"])
| project output1 = substring(input, 1, strlen(input)-2),
output2 = strcat('"', strcat_array(input, '","'), '"')
output1 | output2 |
---|---|
"one","two","three" | "one","two","three" |