Getting Data In

How to parse json field?

rodrwan
New Member

Hello friends, first of all sorry because my english isn't fluent...

I've been searching similar questions, but anyone solved my problem.

In my search code, I have a JSON geolocalization field as follows:

{'latitude' : '-19.9206813889499', 'longitude' : ' '}   

I just want to split it up in two collumns.

How can I do this?

Regards

Tags (3)
0 Karma
1 Solution

mayurr98
Super Champion

hey

Try this run anywhere search

| makeresults 
| eval _raw="{'latitude' : '-19.9206813889499', 'longitude' : ' '}" 
| rex field=_raw "{'latitude'\s:\s'(?<latitude>[^\']*)',\s'longitude'\s:\s'(?<longitude>[^\']+)"

In your environment you should write,

<your_base_search>
| rex field=_raw "{'latitude'\s:\s'(?<latitude>[^\']*)',\s'longitude'\s:\s'(?<longitude>[^\']+)"

let me know if this helps!

View solution in original post

0 Karma

mayurr98
Super Champion

hey

Try this run anywhere search

| makeresults 
| eval _raw="{'latitude' : '-19.9206813889499', 'longitude' : ' '}" 
| rex field=_raw "{'latitude'\s:\s'(?<latitude>[^\']*)',\s'longitude'\s:\s'(?<longitude>[^\']+)"

In your environment you should write,

<your_base_search>
| rex field=_raw "{'latitude'\s:\s'(?<latitude>[^\']*)',\s'longitude'\s:\s'(?<longitude>[^\']+)"

let me know if this helps!

0 Karma

rodrwan
New Member

Thank you all, the solution posted by mayurr98 have solved my problem!

0 Karma

cmerriman
Super Champion

try adding something like this:

|rex field=data "'latitude' : '(?<latitude>.*)', 'longitude' : '(?<longitude>.*)'"
0 Karma
Get Updates on the Splunk Community!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...