<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to display search results in JSON format using the Splunk SDK for Python in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-display-search-results-in-JSON-format-using-the-Splunk/m-p/248026#M47807</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am using Python SDK to perform search and get results.&lt;/P&gt;

&lt;P&gt;With below code I am able to see records in OrderedDict&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;kwargs_export = {"search_mode": "normal"}
searchquery_export = "search index=auto"
exportsearch_results = self.splunk_instance.jobs.export(searchquery_export, **kwargs_export)
# Get the results and display them using the ResultsReader
reader = results.ResultsReader(exportsearch_results)
for result in reader:
     if isinstance(result, dict):
          print "Result: %s" % result
     elif isinstance(result, results.Message):
          # Diagnostic messages may be returned in the results
          print "Message: %s" % result
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But when I am saying &lt;CODE&gt;"output_mode":"json"&lt;/CODE&gt; in &lt;BR /&gt;
&lt;CODE&gt;kwargs_export = {"search_mode": "normal", "output_mode":"json"}&lt;/CODE&gt;, I am seeing nothing in results.&lt;/P&gt;

&lt;P&gt;What could be the reason?&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Fri, 13 May 2016 12:11:22 GMT</pubDate>
    <dc:creator>rupeshhiremath</dc:creator>
    <dc:date>2016-05-13T12:11:22Z</dc:date>
    <item>
      <title>How to display search results in JSON format using the Splunk SDK for Python</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-display-search-results-in-JSON-format-using-the-Splunk/m-p/248026#M47807</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am using Python SDK to perform search and get results.&lt;/P&gt;

&lt;P&gt;With below code I am able to see records in OrderedDict&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;kwargs_export = {"search_mode": "normal"}
searchquery_export = "search index=auto"
exportsearch_results = self.splunk_instance.jobs.export(searchquery_export, **kwargs_export)
# Get the results and display them using the ResultsReader
reader = results.ResultsReader(exportsearch_results)
for result in reader:
     if isinstance(result, dict):
          print "Result: %s" % result
     elif isinstance(result, results.Message):
          # Diagnostic messages may be returned in the results
          print "Message: %s" % result
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But when I am saying &lt;CODE&gt;"output_mode":"json"&lt;/CODE&gt; in &lt;BR /&gt;
&lt;CODE&gt;kwargs_export = {"search_mode": "normal", "output_mode":"json"}&lt;/CODE&gt;, I am seeing nothing in results.&lt;/P&gt;

&lt;P&gt;What could be the reason?&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2016 12:11:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-display-search-results-in-JSON-format-using-the-Splunk/m-p/248026#M47807</guid>
      <dc:creator>rupeshhiremath</dc:creator>
      <dc:date>2016-05-13T12:11:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to display search results in JSON format using the Splunk SDK for Python</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-display-search-results-in-JSON-format-using-the-Splunk/m-p/248027#M47808</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
Python SDK for Splunk does not have a JSON parser. You will need to write your own. If you would just like to see the results then skip the &lt;STRONG&gt;ResultsReader&lt;/STRONG&gt;.  You can try something like:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;kwargs_export = {"search_mode": "normal", "output_mode":"json"}&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;searchquery_export = "search index=auto"&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;exportsearch_results = self.splunk_instance.jobs.export(searchquery_export, **kwargs_export)&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;print exportsearch_results.read()&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2016 19:06:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-display-search-results-in-JSON-format-using-the-Splunk/m-p/248027#M47808</guid>
      <dc:creator>Yasaswy</dc:creator>
      <dc:date>2016-05-13T19:06:45Z</dc:date>
    </item>
  </channel>
</rss>

