<?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 Re: ERROR ExecProcessor - message from &amp;quot;script.py&amp;quot; Error: cannot serialize {json} in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/ERROR-ExecProcessor-message-from-quot-script-py-quot-Error/m-p/307228#M93265</link>
    <description>&lt;P&gt;Solved&lt;BR /&gt;
It was a problem in this line:&lt;BR /&gt;
logevent.data = elements&lt;/P&gt;

&lt;P&gt;Solved line:&lt;BR /&gt;
logevent.data = json.dumps(elements, sort_keys=True, separators=(',',':'))&lt;/P&gt;</description>
    <pubDate>Sun, 04 Mar 2018 22:37:48 GMT</pubDate>
    <dc:creator>manudbc</dc:creator>
    <dc:date>2018-03-04T22:37:48Z</dc:date>
    <item>
      <title>ERROR ExecProcessor - message from "script.py" Error: cannot serialize {json}</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/ERROR-ExecProcessor-message-from-quot-script-py-quot-Error/m-p/307227#M93264</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
I have a Script which download a Json, it look like:&lt;BR /&gt;
    def stream_events(self, inputs, ew):&lt;BR /&gt;
                    ew.log("INFO","Adding data")&lt;BR /&gt;
                    for input_name, input_item in inputs.inputs.iteritems():&lt;BR /&gt;
                            api = input_item["api"]&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;                        try:
                                r = requests.get("URL".format(api))
                                t = json.loads(r.content)
                        except Exception as e:
                                ew.log("ERROR", "Error: %s" % str(e))

                        try:
                                for elements in t['notifications']:
                                        logevent = Event()
                                        logevent.stanza = input_name
                                        logevent.data = elements
                                        ew.write_event(logevent)
                        except Exception as e:
                                ew.log("ERROR", "Error: %s" % str(e))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And I having thaths error in index= "__internals":&lt;BR /&gt;
ERROR ExecProcessor - message from "script.py" Error: cannot serialize {json}&lt;/P&gt;

&lt;P&gt;How can I solve It?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:10:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/ERROR-ExecProcessor-message-from-quot-script-py-quot-Error/m-p/307227#M93264</guid>
      <dc:creator>manudbc</dc:creator>
      <dc:date>2020-09-29T18:10:40Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR ExecProcessor - message from "script.py" Error: cannot serialize {json}</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/ERROR-ExecProcessor-message-from-quot-script-py-quot-Error/m-p/307228#M93265</link>
      <description>&lt;P&gt;Solved&lt;BR /&gt;
It was a problem in this line:&lt;BR /&gt;
logevent.data = elements&lt;/P&gt;

&lt;P&gt;Solved line:&lt;BR /&gt;
logevent.data = json.dumps(elements, sort_keys=True, separators=(',',':'))&lt;/P&gt;</description>
      <pubDate>Sun, 04 Mar 2018 22:37:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/ERROR-ExecProcessor-message-from-quot-script-py-quot-Error/m-p/307228#M93265</guid>
      <dc:creator>manudbc</dc:creator>
      <dc:date>2018-03-04T22:37:48Z</dc:date>
    </item>
  </channel>
</rss>

