Praveen Reddy
Praveen Reddy

Reputation: 7383

Substitute variable name in a dynamic json property

I would like to use the variable settingName for the dynamic json property. How can i accomplish that?

let settingName = 'LaunchNext';

DSEvents
| where  Timestamp > ago(1d) and Data contains (settingName)
| summarize count() by tostring(parsejson(tostring(Data.Settings)).LaunchNext.value)

I want to substitute the variable instead of the actual property

parsejson(tostring(Data.Settings)).LaunchNext.value

Upvotes: 0

Views: 158

Answers (1)

Praveen Reddy
Praveen Reddy

Reputation: 7383

Enclosing the variable in [] worked for me

tostring(parsejson(tostring(Data.Settings)).[settingName].value)

Upvotes: 0

Related Questions