Splunk Search

How to parse JSON List


Hey I have the following query:



| makeresults | eval prediction_str_body="[{'stringOutput':'Alpha','doubleOutput':0.52},{'stringOutput':'Beta','doubleOutput':0.48}]"



But no matter what I do, I can't seem to extract each element of the list and turn it into it's own event.

I'd ideally like a table afterwards of the sum of each value:

Alpha: 0.52
Beta: 0.48

For all rows.


Labels (1)
0 Karma


Ah wonderful, thanks so much!

0 Karma


Pro tip: It is great that you are using makeresults to post simulation.  But do not mangle JSON.

The command you are looking for is mvexpand.


| makeresults | eval prediction_str_body="[{\"stringOutput\":\"Alpha\",\"doubleOutput\":0.52},{\"stringOutput\":\"Beta\",\"doubleOutput\":0.48}]"
| spath input=prediction_str_body path={}
| mvexpand {}
| spath input={}


Your sample gives


Hope this helps.

Tags (1)
Get Updates on the Splunk Community!

Splunk Observability Cloud | Unified Identity - Now Available for Existing Splunk ...

Raise your hand if you’ve already forgotten your username or password when logging into an account. (We can’t ...

Index This | How many sides does a circle have?

February 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

Registration for Splunk University is Now Open!

Are you ready for an adventure in learning?   Brace yourselves because Splunk University is back, and it's ...