4
votes

I'm working on a logic app which will create a bug I have to display description in the work item like below:

{
    "Description":
    {
        "Title":"", 
        "Validation step":"",
        "OperationActivityId:":"",
        "Environment detailsLink":"",
        "Please click here":"",
        "ErrorMessage":""
    }
}

I'm Querying all above mentioned fields as result of query from Kusto(KQL) and getting all the required fields but I don't know how to convert it to make it Json. Can anyone help me on this..?

Thanks in advance.

1
Hi Gaurav, please accept the answer if it helps (see this). If you're missing some info, please let me know what's missing, and I'll elaborate.Slavik N

1 Answers

5
votes

Here you go:

PackedRecordlet MyTable = datatable(Category:string, Value:long) [
   "A", 1,
   "A", 3,
   "A", 5,
   "B", 1,
   "B", 2
];
MyTable
| extend PackedRecord = pack_all()
| summarize Result = make_list(PackedRecord)

This will output everything in a nice json:

[
  {
    "Category": "A",
    "Value": 1
  },
  {
    "Category": "A",
    "Value": 3
  },
  {
    "Category": "A",
    "Value": 5
  },
  {
    "Category": "B",
    "Value": 1
  },
  {
    "Category": "B",
    "Value": 2
  }
]

Explanation