azure-data-explorerkqlsentinel

Kusto remove bracket from JSON array to a list


I have a very simple question, however I can't seemed to find the answer to this. How do I transform a json array variable

["one","two","three"]

into the following format suitable for string search using parameter ?

"one","two","three"

Thank you brain trusts....


Solution

  • You could use the following functions:

    for example:

    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"