<?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 DemistoException: Failed to parse json object from response in Cortex XSOAR Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/demistoexception-failed-to-parse-json-object-from-response/m-p/589682#M3394</link>
    <description>&lt;P&gt;I'm making a request in an integration to an external API&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;        return self._http_request(
            'POST','export/download',
            headers={'accept': "application/octet-stream",
                     'content-type': "application/x-www-form-urlencoded"},
            data=payload)&lt;/LI-CODE&gt;
&lt;P&gt;and I get back a data stream - it's looks like it should be a JSON array, but is actually not, it's simply a long list of separate JSON objects, e.g.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{"id":1}
{"id":2}
{"id":3}&lt;/LI-CODE&gt;
&lt;P&gt;so I get the error&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;   File "&amp;lt;string&amp;gt;", line 66, in export_download
   File "&amp;lt;string&amp;gt;", line 9423, in _http_request
   File "&amp;lt;string&amp;gt;", line 9527, in _handle_success
   File "&amp;lt;string&amp;gt;", line 9545, in cast_response
 DemistoException: Failed to parse json object from response: b'{"id":"aaaaa","bd.hostname":"host1.bla"}\n{"id":"bbbbb","bd.hostname":"host2.bla"}\n&lt;/LI-CODE&gt;
&lt;P&gt;and so on...&lt;/P&gt;
&lt;P&gt;How do I stop Demisto thinking this is a JSON object. - Line 66 is the one shown&lt;/P&gt;</description>
    <pubDate>Mon, 17 Jun 2024 06:16:29 GMT</pubDate>
    <dc:creator>bowesmana</dc:creator>
    <dc:date>2024-06-17T06:16:29Z</dc:date>
    <item>
      <title>DemistoException: Failed to parse json object from response</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/demistoexception-failed-to-parse-json-object-from-response/m-p/589682#M3394</link>
      <description>&lt;P&gt;I'm making a request in an integration to an external API&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;        return self._http_request(
            'POST','export/download',
            headers={'accept': "application/octet-stream",
                     'content-type': "application/x-www-form-urlencoded"},
            data=payload)&lt;/LI-CODE&gt;
&lt;P&gt;and I get back a data stream - it's looks like it should be a JSON array, but is actually not, it's simply a long list of separate JSON objects, e.g.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{"id":1}
{"id":2}
{"id":3}&lt;/LI-CODE&gt;
&lt;P&gt;so I get the error&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;   File "&amp;lt;string&amp;gt;", line 66, in export_download
   File "&amp;lt;string&amp;gt;", line 9423, in _http_request
   File "&amp;lt;string&amp;gt;", line 9527, in _handle_success
   File "&amp;lt;string&amp;gt;", line 9545, in cast_response
 DemistoException: Failed to parse json object from response: b'{"id":"aaaaa","bd.hostname":"host1.bla"}\n{"id":"bbbbb","bd.hostname":"host2.bla"}\n&lt;/LI-CODE&gt;
&lt;P&gt;and so on...&lt;/P&gt;
&lt;P&gt;How do I stop Demisto thinking this is a JSON object. - Line 66 is the one shown&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2024 06:16:29 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/demistoexception-failed-to-parse-json-object-from-response/m-p/589682#M3394</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2024-06-17T06:16:29Z</dc:date>
    </item>
    <item>
      <title>Re: DemistoException: Failed to parse json object from response</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/demistoexception-failed-to-parse-json-object-from-response/m-p/589941#M3399</link>
      <description>&lt;P&gt;After much digging, I found you need to set resp_type on the request - not sure why there is no simple documentation on the class, but just needed to add the following to the request&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;resp_type='text'&lt;/LI-CODE&gt;
&lt;P&gt;Had to eventually find the option here&lt;/P&gt;
&lt;P&gt;&lt;A href="https://raw.githubusercontent.com/demisto/content/master/Packs/Base/Scripts/CommonServerPython/CommonServerPython.py" target="_blank"&gt;https://raw.githubusercontent.com/demisto/content/master/Packs/Base/Scripts/CommonServerPython/CommonServerPython.py&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2024 23:20:13 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/demistoexception-failed-to-parse-json-object-from-response/m-p/589941#M3399</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2024-06-19T23:20:13Z</dc:date>
    </item>
  </channel>
</rss>

