Splunk Dev

JSONResultsReader

MK3
Explorer

Hello,

I have this -

results = service.jobs.oneshot(searchquery_oneshot, **kwargs_oneshot)
reader = results.JSONResultsReader(oneshotsearch_results)
 
dict = json.loads(oneshotsearch_results)  # to get dict to send data outside splunk selectively
 
Error:
TypeError: the JSON object must be str, bytes or bytearray, not ResponseReader
 
How do I fix this?
 
Thanks
 
 
0 Karma
1 Solution

PaulPanther
Motivator

Please try:

    oneshotsearch_results = service.jobs.oneshot(searchquery_oneshot, **kwargs_oneshot)
    reader = results.JSONResultsReader(oneshotsearch_results)

 

View solution in original post

0 Karma

PaulPanther
Motivator

Please try:

    oneshotsearch_results = service.jobs.oneshot(searchquery_oneshot, **kwargs_oneshot)
    reader = results.JSONResultsReader(oneshotsearch_results)

 

0 Karma

MK3
Explorer

hi @PaulPanther, after doing so as you suggested, I am trying to read the JSONResultsReader object like this-

for item in reader:

    if(isinstance(item, dict)):

        for key in item:
            if(key == '<...>'):
                A = str(item[key])
                print('A is :',A)
 
The above code was working till yesterday. Now it does not enter the 1st for loop anymore.
0 Karma
Get Updates on the Splunk Community!

App Platform's 2025 Year in Review: A Year of Innovation, Growth, and Community

As we step into 2026, it’s the perfect moment to reflect on what an extraordinary year 2025 was for the Splunk ...

Operationalizing Entity Risk Score with Enterprise Security 8.3+

Overview Enterprise Security 8.3 introduces a powerful new feature called “Entity Risk Scoring” (ERS) for ...

Unlock Database Monitoring with Splunk Observability Cloud

  In today’s fast-paced digital landscape, even minor database slowdowns can disrupt user experiences and ...