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!

Application management with Targeted Application Install for Victoria Experience

  Experience a new era of flexibility in managing your Splunk Cloud Platform apps! With Targeted Application ...

Index This | What goes up and never comes down?

January 2026 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Splunkers, Pack Your Bags: Why Cisco Live EMEA is Your Next Big Destination

The Power of Two: Splunk &#43; Cisco at "Ludicrous Scale"   You know Splunk. You know Cisco. But have you seen ...