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!

Index This | What is broken 80% of the time by February?

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

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...

Splunk MCP & Agentic AI: Machine Data Without Limits

Discover how the Splunk Model Context Protocol (MCP) Server can revolutionize the way your organization uses ...