'Issue with the Kusto pack function producing json with \u200b special character

Let's take the following query as an example to reproduce the issue:

datatable(Computer:string, TimeGenerated:datetime, data:dynamic)
[
    "comp1",  datetime(2019-02-07 16:31:15), dynamic([{"prop1": 2}, {"prop2": 0.8}, {"prop3": 12.204532}, {"prop4": 0}]),
    "comp2",  datetime(2019-02-07 16:31:15), dynamic([{"prop1": 2}, {"prop2": 0.8}]),
    "comp3",  datetime(2019-02-07 16:31:15), dynamic([{"prop2": 0.8}, {"prop3": 12.204532}, {"prop4": 0}]),
]
| mv-apply e = data on (summarize data = make_bag(e))
| extend o = pack(Computer, data)
| project TimeGenerated, Computer, o

If you look at the JSON produced by pack and try to validate it, you will see that there is an extra character that makes the json invalid.

enter image description here

You'll see that the validator shows:

enter image description here

The special character shown in the picture is \u200b.

Am I doing something wrong on the query or is it a potential bug and how to fix it please.

Thanks in advance.



Solution 1:[1]

As per my observations in my local environment when you are running the query in the log analytics workspace you are writing to create a bag twice in mv-apply and in extend due to this we are getting a special character '.' in output 'o'. we removed the mv-apply and tested the query it doesn't show any error to us.

enter image description here

Here are our observations with mv-apply and without mv-apply.

  1. With mv-apply

enter image description here

  1. With out mv-apply enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 SaiSakethGuduru-MT