Getting Data In

Split JSON object attributes out as key-value

johnoxley_liqui
Engager

I have a JSON object of currency conversion rates as the event, which looks like

{
  "base": "USD",
  "rates": {
    "GBP": 1.6,
    "ZAR": 10.2
  }
}

I want to pull the rates out as a table to look like

Currency      Rate
========      ====
GBP            1.6
ZAR           10.2

I can't figure out how to pull out the attribute as a column

Tags (1)

fervin
Path Finder

How's this look?

sourcetype=your_json | head 1
| spath output=gbp path=rates{}.GBP
| spath output=zar path=rates{}.ZAR
| table gbp, zar

0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...