SOLVED

Need help with a parsing query

Iron Contributor

I'm having a hard time querying out this bit of JSON (extracted from a larger JSON) into their own columns:

 

[{"name":"Category","value":"Direct Agent"},{"name":"Computer","value":"servername.domeain.net"}]

 

Essentially I want to have a column named agentCategory and a column named serverName with these values in them. 

 

Thanks in advance!

2 Replies
best response confirmed by Scott Allison (Iron Contributor)
Solution
Simple but not elegant?

let a = todynamic('[{"name":"Category","value":"Direct Agent"},{"name":"Computer","value":"servername.domeain.net"}]');
print a=parse_json(a)
| extend agentCategory = tostring(a[0].value)
| extend serverName_ = tostring(a[1].value)
Thanks Clive! You came through again! :)
1 best response

Accepted Solutions
best response confirmed by Scott Allison (Iron Contributor)
Solution
Simple but not elegant?

let a = todynamic('[{"name":"Category","value":"Direct Agent"},{"name":"Computer","value":"servername.domeain.net"}]');
print a=parse_json(a)
| extend agentCategory = tostring(a[0].value)
| extend serverName_ = tostring(a[1].value)

View solution in original post