<?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: Parse JSON array from DQL in workflows in Automations</title>
    <link>https://community.dynatrace.com/t5/Automations/Parse-JSON-array-from-DQL-in-workflows/m-p/291470#M2449</link>
    <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/25081"&gt;@Jan_VanBelle&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;DIV&gt;I just wanted to check in and see if you still need help with this. If so, I’d be happy to look into it for you! &lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;BR /&gt;Please let me know what works best for you.&lt;/DIV&gt;</description>
    <pubDate>Mon, 15 Dec 2025 10:48:49 GMT</pubDate>
    <dc:creator>IzabelaRokita</dc:creator>
    <dc:date>2025-12-15T10:48:49Z</dc:date>
    <item>
      <title>Parse JSON array from DQL in workflows</title>
      <link>https://community.dynatrace.com/t5/Automations/Parse-JSON-array-from-DQL-in-workflows/m-p/284038#M2314</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;We're trying to do something with records which have been open for a period of time.&lt;/P&gt;
&lt;P&gt;So I've created a workflow with (for now: ) 2 steps:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;fetch the data via a DQL query --&amp;gt; works fine&lt;/LI&gt;
&lt;LI&gt;parse the DQL output and find out what to do with it --&amp;gt; gives me headaches&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;The problem I seem to face is: the array I get from DQL seems to be an object, but all records within are treated as strings&lt;/P&gt;
&lt;P&gt;the code:&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;// optional import of sdk modules
import { execution } from '@dynatrace-sdk/automation-utils';

export default async function ({ execution_id }) {
  // your code goes here
  // e.g. get the current execution
  console.log("wait for log running problems");
  
  const exe = await execution(execution_id);
  const problems_array = await exe.result("fetch_long_running_problems")
  
  console.log("problems_data: " + typeof(problems_array));
  //console.log(problems_array);

  for (const problem_record in problems_array.records) {
    console.log("* (" + typeof(problem_record) + ") : " + problem_record); 
  }

  // not yet important for now
  return { problems_array };
}&lt;/LI-CODE&gt;
&lt;P&gt;a snippet from the JSON I get:&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;[
  {
    timestamp: "2025-08-18T03:08:03.345000000Z",
    display_id: "P-25085838",
    "event.name": "Process unavailable",
    entity_tags: [
      "Application:XXX",
      "Environment:400DEV",
      "ExeName:RI.demo.B*B.Sif.Signal*L.Daemons.Dispatcher.exe",
      "HostName:servername",
      "Process Group Availability Monitored:true",
      "ProcessType:Daemon"
    ],
    "event.description": "# Process unavailable\n" +
      "\n" +
      "The problem **affects 1 entity** overall.\n"
  },
  {
    timestamp: "2025-08-18T07:44:47.835000000Z",
    display_id: "P-25086167",
    "event.name": "RI - PENORCH - demo NServiceBus Handlers Service is in undesirable (stopped) state",
    entity_tags: [
      "Application:XXX",
      "Environment:200REL",
      "HostName:server-url"
    ],
    "event.description": "# RI - PENORCH - demo NServiceBus Handlers Service is in undesirable (stopped) state\n" +
      "\n" +
      "The problem **affects 1 entity** overall.\n" 
  },
  {
    timestamp: "2025-08-18T03:42:14.394000000Z",
    display_id: "P-25086104",
    "event.name": "200REL - NSB errors for NPR.B2Bdemo",
    entity_tags: [ "Environment:200REL", "Queues:NServiceBus", "Team:XXX" ],
    "event.description": "# 200REL - NSB errors for NPR.B2Bdemo\n" +
      "\n" +
      "The problem **affects 1 entity** overall.\n"
  },
  {
    timestamp: "2025-08-18T08:50:23.818000000Z",
    display_id: "P-25086103",
    "event.name": "200REL - NSB errors for NPR.demo_SubNotifications",
    entity_tags: [ "Environment:200REL", "Queues:NServiceBus", "Team:XXX" ],
    "event.description": "# 200REL - NSB errors for NPR.demo_SubNotifications\n" +
      "\n" +
      "The problem **affects 1 entity** overall.\n"
  }
]&lt;/LI-CODE&gt;
&lt;P&gt;... but the output I get for now is:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;wait for log running problems
problems_data: object
* (string) : 0
* (string) : 1
* (string) : 2
* (string) : 3
* (string) : 4
* (string) : 5
* (string) : 6
* (string) : 7
* (string) : 8&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could someone give a hint how to tackle this?&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; Jan&lt;/P&gt;</description>
      <pubDate>Mon, 15 Dec 2025 10:48:23 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Automations/Parse-JSON-array-from-DQL-in-workflows/m-p/284038#M2314</guid>
      <dc:creator>Jan_VanBelle</dc:creator>
      <dc:date>2025-12-15T10:48:23Z</dc:date>
    </item>
    <item>
      <title>Re: Parse JSON array from DQL in workflows</title>
      <link>https://community.dynatrace.com/t5/Automations/Parse-JSON-array-from-DQL-in-workflows/m-p/291470#M2449</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/25081"&gt;@Jan_VanBelle&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;DIV&gt;I just wanted to check in and see if you still need help with this. If so, I’d be happy to look into it for you! &lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;BR /&gt;Please let me know what works best for you.&lt;/DIV&gt;</description>
      <pubDate>Mon, 15 Dec 2025 10:48:49 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Automations/Parse-JSON-array-from-DQL-in-workflows/m-p/291470#M2449</guid>
      <dc:creator>IzabelaRokita</dc:creator>
      <dc:date>2025-12-15T10:48:49Z</dc:date>
    </item>
  </channel>
</rss>

