用半随机数据自动化JSON子字符串到KQL?
因此,目前,我有以下简单的代码,仅为我自己构建一个表并查看数据
azure_devops_work_item_events_CL
| summarize any(WorkItemType_s, TeamProject_s, Title_s,
AssignedTo_s, State_s, Reason_s) by WorkItemId_d, Relations_s
| order by WorkItemId_d desc
我的问题是REMATIGHT_S数据正在拉一个超长字符串,每个实例的长度几乎都不同,尽管每个ex的格式都是相同的:
resseady_s |
---|
[{“ rel”:“ system.linktypes.erhierarchy-reverse”,“ url”:“ https://dev.azure.com/xxxx/a69ffa35-e99f-42ea-42ea-42ea-42ea-a254/_apis/_apis/withit/workitems/197138 “,”属性“:{” ISLOCKED“:false”,“名称”:“ parent”}}] |
[{“ rel”:“ system.linktypes.hierarchy-reverse”,“ url”:“ https:// dev。 azure.com/xxxx/d888804f3-b064-4489-9705/_apis/wit/workitems/234449“,”属性“:{” islocked':islocked“:false”:false,“ name” name'name':“ parent”}}}}}}] |
[ }}] “ system.linktypes.hierarchy-forward”,“ url”:“ https://dev.azure.com/xxxx/a69ffa35-e99f-42ea-42ea-a254/_apis/_apis/wit/workitems/workitems/workitems/247970”,“ Islocked“:false,” name”:“ child”}},{“ rel”:“ system.linktypes.hierarchy-forward”,“ url”:“ https://dev.azure.com/xxxxx/a69ffa355-e999f -42EA-A254/_APIS/WIT/WORKITEMS/242838“,“属性”:{“ Islocked”:false,“ name”:“ child”}},{“ rel”:“ system.linktypes.linktypes.hierarchy-forward”, “ url”:“ https://dev.azure.com/xxxx/a69ffa35-e99f-42ea-a254/_apis/wit/with/workitems/242835”,“属性”,“属性”:儿童“}},{“ rel”:“ system.linktypes.hierarchy-forward”,“ url”:“ https://dev.azure.com/xxxxx/a69ffa35-e99f-e99f-42ea-42ea-42ea-42ea-a254/_apis/_apis/workitems/workitems /246163“,“属性”:{“ Islocked”:false,“ name”:“ child”}},{“ rel”:“ system.linktypes.hierarchy-forward”,“ url”,“ url”:“ https:// https:// 。 “ system.linktypes.hierarchy-forward”,“ url”:“ https://dev.azure.com/xxxx/a69ffa35-e99f-42ea-42ea-a254/_apis/_apis/wit/workitems/workitems/229566” Islocked“:false,” name”:“ child”}},{“ rel”:“ system.linktypes.hierarchy-forward”,“ url”:“ https://dev.azure.com/xxxxx/a69ffa355-e999f -42EA-A254/_APIS/WIT/WORKITEMS/228347“,“属性”:{“ Islocked”:false,“ name”:“ child”}},{“ rel”:“ system.linktypes.linktypes.linktypes.hierarchy-forward”, “ url”:“ https://dev.azure.com/xxxx/a69ffa35-e99f-42ea-a254/_apis/wit/workitems/workitems/240648”,“属性”,“属性”:儿童“}},{“ rel”:“ system.linktypes.hierarchy-forward”,“ url”:“ https://dev.azure.com/xxxxx/a69ffa35-e99f-e99f-42ea-42ea-42ea-42ea-a254/_apis/_apis/workitems/workitems /234833“,“属性”:{“ Islocked”:false,“ name”:“ child”}},{“ rel”:“ system.linktypes.hierarchy-forward”,“ url”,“ url”:“ https:// https:// 。 “ system.linktypes.hierarchy-forward”,“ url”:“ https://dev.azure.com/xxxx/a69ffa35-e99f-42ea-42ea-a254/_apis/_apis/wits/workitems/workitems/workitems/242837” Islocked“:false,” name”:“ child”}},{“ rel”:“ system.linktypes.hierarchy-forward”,“ url”:“ https://dev.azure.com/xxxxx/a69ffa355-e999f -42EA-A254/_APIS/WIT/WORKITEMS/234803“,“属性”:{“ Islocked”:false,“ name”:“ child”}},{“ rel”:“ system.linktypes.linktypes.hierarchy-forward”, “ url”:“ https://dev.azure.com/xxxx/a69ffa35-e99f-42ea-a254/_apis/wit/workitems/workitems/234801”,“属性”,“属性”:儿童“}},{“ rel”:“ system.linktypes.hierarchy-forward”,“ url”:“ https://dev.azure.com/xxxxx/a69ffa35-e99f-e99f-42ea-42ea-42ea-42ea-a254/_apis/_apis/workitems/workitems /246352“,“属性”:{“ Islocked”:false,“ name”:“ child”}},{“ rel”:“ system.linktypes.hierarchy-forward”,“ url”,“ url”:“ https:// 。 “ system.linktypes.hierarchy-forward”,“ url”:“ https://dev.azure.com/xxxx/a69ffa35-e99f-42ea-42ea-a254/_apis/_apis/_apis/withet/workitems/workitems/234834”,“ Islocked“:false,” name”:“ child”}},{“ rel”:“ system.linktypes.hierarchy-forward”,“ url”:“ https://dev.azure.com/xxxxx/a69ffa355-e999f -42EA-A254/_APIS/WIT/WORKITEMS/234838“,“属性”:{“ Islocked”:false,“ name”:“ child”}},{“ rel”:“ system.linktypes.linktypes.hierarchy-forward”,hierarchy-ford-forward”, “ url”:“ https://dev.azure.com/xxxx/a69ffa35-e99f-42ea-a254/_apis/wit/with/workitems/242836”,“属性”,“属性”:儿童“}},{“ rel”:“ system.linktypes.hierarchy-resverse”,“ url”:“ https://dev.azure.com/xxxxxxxx x/a69ffa35-e99f-42eaf-42ea-42ea-42ea-42ea-a254/_apis/_apis/wwit/workitemss /218335“,“属性”:{“ Islocked”:false,“ name”:“ parent”}},{“ rel”:“ system.linktypes.hierarchy-forward”,“ url”,“ url”:“ https:// 。 |
当我询问我的桌子时的样子。我完全失去了如何以一种方式来解析表,使我能够自动化每个链接末尾的数字以及每个字符串末端的名称部分。尤其是当表的某些部分在1中有40个字符串时。请注意,如果完全影响这一点,请注意所有数据均以JSON的形式进行。最终结果需要看起来像这个
孩子 | 父母 |
---|---|
240241 | 240541 |
或此
项目 | 链接 |
---|---|
240241 | 儿童 |
240541 | 父母 |
对格式道歉,我无法将大量数据设置为正确地格式化到表中
So currently I have the following simple code to just build out a table for myself and look at data
azure_devops_work_item_events_CL
| summarize any(WorkItemType_s, TeamProject_s, Title_s,
AssignedTo_s, State_s, Reason_s) by WorkItemId_d, Relations_s
| order by WorkItemId_d desc
My problem is the Relations_s data is pulling a super long string that's different in length pretty much every instance although the format is the same for each one ex:
Relations_s |
---|
[ { "rel": "System.LinkTypes.Hierarchy-Reverse", "url": "https://dev.azure.com/xxxx/a69ffa35-e99f-42ea-a254/_apis/wit/workItems/197138", "attributes": { "isLocked": false, "name": "Parent" } } ] |
[ { "rel": "System.LinkTypes.Hierarchy-Reverse", "url": "https://dev.azure.com/xxxx/d88804f3-b064-4489-9705/_apis/wit/workItems/234449", "attributes": { "isLocked": false, "name": "Parent" } } ] |
[ { "rel": "System.LinkTypes.Hierarchy-Forward", "url": "https://dev.azure.com/xxxx/a69ffa35-e99f-42ea-a254/_apis/wit/workItems/247970", "attributes": { "isLocked": false, "name": "Child" } }, { "rel": "System.LinkTypes.Hierarchy-Forward", "url": "https://dev.azure.com/xxxx/a69ffa35-e99f-42ea-a254/_apis/wit/workItems/242838", "attributes": { "isLocked": false, "name": "Child" } }, { "rel": "System.LinkTypes.Hierarchy-Forward", "url": "https://dev.azure.com/xxxx/a69ffa35-e99f-42ea-a254/_apis/wit/workItems/242835", "attributes": { "isLocked": false, "name": "Child" } }, { "rel": "System.LinkTypes.Hierarchy-Forward", "url": "https://dev.azure.com/xxxx/a69ffa35-e99f-42ea-a254/_apis/wit/workItems/246163", "attributes": { "isLocked": false, "name": "Child" } }, { "rel": "System.LinkTypes.Hierarchy-Forward", "url": "https://dev.azure.com/xxxx/a69ffa35-e99f-42ea-a254/_apis/wit/workItems/234839", "attributes": { "isLocked": false, "name": "Child" } }, { "rel": "System.LinkTypes.Hierarchy-Forward", "url": "https://dev.azure.com/xxxx/a69ffa35-e99f-42ea-a254/_apis/wit/workItems/229566", "attributes": { "isLocked": false, "name": "Child" } }, { "rel": "System.LinkTypes.Hierarchy-Forward", "url": "https://dev.azure.com/xxxx/a69ffa35-e99f-42ea-a254/_apis/wit/workItems/228347", "attributes": { "isLocked": false, "name": "Child" } }, { "rel": "System.LinkTypes.Hierarchy-Forward", "url": "https://dev.azure.com/xxxx/a69ffa35-e99f-42ea-a254/_apis/wit/workItems/240648", "attributes": { "isLocked": false, "name": "Child" } }, { "rel": "System.LinkTypes.Hierarchy-Forward", "url": "https://dev.azure.com/xxxx/a69ffa35-e99f-42ea-a254/_apis/wit/workItems/234833", "attributes": { "isLocked": false, "name": "Child" } }, { "rel": "System.LinkTypes.Hierarchy-Forward", "url": "https://dev.azure.com/xxxx/a69ffa35-e99f-42ea-a254/_apis/wit/workItems/240647", "attributes": { "isLocked": false, "name": "Child" } }, { "rel": "System.LinkTypes.Hierarchy-Forward", "url": "https://dev.azure.com/xxxx/a69ffa35-e99f-42ea-a254/_apis/wit/workItems/242837", "attributes": { "isLocked": false, "name": "Child" } }, { "rel": "System.LinkTypes.Hierarchy-Forward", "url": "https://dev.azure.com/xxxx/a69ffa35-e99f-42ea-a254/_apis/wit/workItems/234803", "attributes": { "isLocked": false, "name": "Child" } }, { "rel": "System.LinkTypes.Hierarchy-Forward", "url": "https://dev.azure.com/xxxx/a69ffa35-e99f-42ea-a254/_apis/wit/workItems/234801", "attributes": { "isLocked": false, "name": "Child" } }, { "rel": "System.LinkTypes.Hierarchy-Forward", "url": "https://dev.azure.com/xxxx/a69ffa35-e99f-42ea-a254/_apis/wit/workItems/246352", "attributes": { "isLocked": false, "name": "Child" } }, { "rel": "System.LinkTypes.Hierarchy-Forward", "url": "https://dev.azure.com/xxxx/a69ffa35-e99f-42ea-a254/_apis/wit/workItems/242839", "attributes": { "isLocked": false, "name": "Child" } }, { "rel": "System.LinkTypes.Hierarchy-Forward", "url": "https://dev.azure.com/xxxx/a69ffa35-e99f-42ea-a254/_apis/wit/workItems/234834", "attributes": { "isLocked": false, "name": "Child" } }, { "rel": "System.LinkTypes.Hierarchy-Forward", "url": "https://dev.azure.com/xxxx/a69ffa35-e99f-42ea-a254/_apis/wit/workItems/234838", "attributes": { "isLocked": false, "name": "Child" } }, { "rel": "System.LinkTypes.Hierarchy-Forward", "url": "https://dev.azure.com/xxxx/a69ffa35-e99f-42ea-a254/_apis/wit/workItems/242836", "attributes": { "isLocked": false, "name": "Child" } }, { "rel": "System.LinkTypes.Hierarchy-Reverse", "url": "https://dev.azure.com/xxxx/a69ffa35-e99f-42ea-a254/_apis/wit/workItems/218335", "attributes": { "isLocked": false, "name": "Parent" } }, { "rel": "System.LinkTypes.Hierarchy-Forward", "url": "https://dev.azure.com/xxxx/a69ffa35-e99f-42ea-a254/_apis/wit/workItems/234832", "attributes": { "isLocked": false, "name": "Child" } } ] |
This is a small sample of what my table looks like when I query it. I'm completely lost on how I can parse the table in such a way that I'm able to automate pulling the number at the end of every link and the name portion at the end of each string. Especially when some parts of the table have 40 strings in 1. Note all the data is in the form of a JSON if that impacts this at all. The end result needs to look something like this
Child | Parent |
---|---|
240241 | 240541 |
Or this
Item | Link |
---|---|
240241 | Child |
240541 | Parent |
Apologies for the formatting I can't get the massive data set to properly format into a table
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据其名称
Ressection_s
可能是一个字符串,因此需要转换为JSON(通过使用todynamic()
)。Option 1
Option 2
According to its name
Relations_s
is probably a string, therefore needs conversion to JSON (by usingtodynamic()
).Option 1
Option 2
如果我正确理解了您的描述,则可以使用
mv-apply
和parse
运算符:If I understood your description correctly, you could try the following, using the
mv-apply
andparse
operators: