0

This is my datatable:

datatable(Id:dynamic)
[
    dynamic([987654321][Just Kusto Things]), 
]

and I've extracted 1 field from a json using

| project ID=parse_json(Data).["CustomValue"] 

And the result is something like - [987654321][Just Kusto Things]. I wanted to extract the numbered value(987654321) within the 1st square brackets. How to best retrieve that value? Using split/parse/extract?

SM04
  • 1
  • 3

2 Answers2

1

the datatable in the sample is not valid. If the values are just an array then you can get the results by using the array position like this:

datatable(Id:dynamic)
[
    dynamic([987654321,"Just Kusto Things"]), 
]
| extend Id = Id[0]

If it is something else, please provide a valid datatable with an example that is representative of the real data.

Avnera
  • 7,088
  • 9
  • 14
0

the result is something like - [987654321][Just Kusto Things]. I wanted to extract the numbered value(987654321) within the 1st square brackets. How to best retrieve that value?

you can use the parse operator

For example:

print input = '[987654321][Just Kusto Things]'
| parse input with '[' output:long ']' *
Yoni L.
  • 22,627
  • 2
  • 29
  • 48
  • Thanks this works! Is there a way I can use extract and also is there a thing to worry between parse and extract? – SM04 Aug 23 '21 at 21:11
  • in this case, using `parse` would be more efficient than using `extract()` - as you don't need to use a regular expression – Yoni L. Aug 23 '21 at 21:30